﻿body {
    font-family: 'Roboto', sans-serif;
    background: #fafafa;
    margin: 0;
    padding: 0;
}

/* Color verde principal del logo */
:root {
    --color-verde-primario: #34c759; /* Verde principal */
    --color-verde-oscuro: #28a745; /* Verde oscuro */
    --color-gris-oscuro: #333333; /* Gris oscuro */
    --color-fondo: #ffffff; /* Fondo blanco */
}

.main-container {
    text-align: center;
    padding: 10px;
    max-width: 1200px;
    margin: 0 auto 0; /* Deja espacio para la navbar fija */
}

.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    margin-top: 20px;
}

.info-card {
    max-width: 350px;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: var(--color-fondo);
    text-align: left;
    flex: 1;
    transition: transform 0.3s, box-shadow 0.3s;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.categories-container {
    flex: 2;
    max-width: 700px;
}

.notes-banner {
    max-width: 880px;
    margin: 10px auto 24px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid rgba(52, 199, 89, 0.14);
    background: linear-gradient(180deg, #ffffff 0%, #f7fcf8 100%);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    text-align: left;
}

.notes-banner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.notes-banner-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-verde-oscuro);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.notes-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid rgba(52, 199, 89, 0.16);
    border-radius: 999px;
    background: rgba(52, 199, 89, 0.08);
    color: #53725a;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
}

.notes-toggle .material-icons {
    font-size: 18px;
}

.notes-toggle:hover {
    background: rgba(52, 199, 89, 0.14);
}

.notes-banner-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    align-items: center;
    color: #4a4a4a;
    font-size: 14px;
    line-height: 1.45;
    margin-top: 10px;
}

.notes-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(52, 199, 89, 0.1);
    color: #2e5e39;
    white-space: nowrap;
}

.notes-text {
    color: #50575e;
}

.notes-banner.is-collapsed {
    padding-top: 12px;
    padding-bottom: 12px;
}

.notes-banner.is-collapsed .notes-banner-items {
    display: none;
}

.mdl-card {
    width: 90%;
    max-width: 520px;
    margin: 10px auto;
    min-height: 150px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    background-color: var(--color-fondo);
    animation: fadeIn 0.5s ease-in-out;
}

.mdl-card:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.mdl-card__actions {
    text-align: center;
}

.card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-right: 14px;
}

.card-title-row .mdl-card__title-text {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding-right: 4px;
}

.share-icon-button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    color: #7a838f;
    background: transparent;
    border: 0;
    border-radius: 999px;
    flex-shrink: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.share-icon-svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.9;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.share-icon-button:hover,
.share-icon-button:focus {
    background: rgba(52, 199, 89, 0.1);
    color: var(--color-verde-oscuro);
}

.share-icon-button.is-busy {
    opacity: 0.7;
}

.mdl-button {
    margin: 5px;
    min-width: 180px;
    color: #fff;
    background-color: var(--color-verde-primario);
    transition: background-color 0.3s ease;
}

.mdl-button.mdl-button--accent {
    background-color: var(--color-verde-oscuro);
}

.mdl-button:hover {
    background-color: #2ca744;
}

.category-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

h1 {
    margin-bottom: 20px;
    color: var(--color-verde-primario);
}

h2 {
    color: var(--color-gris-oscuro);
}

h3 {
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--color-verde-oscuro);
}

.category-section {
    margin-bottom: 30px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Navbar styles */
.mdl-layout__header {
    background-color: var(--color-verde-primario);
    color: #ffffff;
}

.mdl-layout__header-row {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.mdl-layout__header-row > a,
.mdl-layout__header-row > .mdl-layout-title,
.mdl-layout__header-row > .mdl-layout-spacer,
.mdl-layout__header-row > .mdl-navigation {
    min-width: 0;
}

.mdl-layout-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-mobile {
    display: none;
}

.mdl-layout__header-row .mdl-navigation__link {
    color: #ffffff;
    transition: background-color 0.3s ease;
}

.mdl-navigation__link:hover {
    background-color: var(--color-verde-oscuro);
    color: #ffffff;
}

@media (max-width: 920px) {
    body.is-chart-view .mdl-layout__header {
        display: none;
    }

    body.is-chart-view .mdl-layout__content {
        margin-top: 0;
        overflow-x: hidden;
    }

    body.is-chart-view .main-container {
        max-width: none;
        padding-left: 0;
        padding-right: 0;
        padding-top: 0;
        width: 100%;
    }

    body.is-chart-view .iframe-container {
        width: 100%;
        max-width: 100%;
        min-height: 100dvh;
        margin-top: 0;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 96px;
    }

    body.is-chart-view .iframe-toolbar {
        position: fixed;
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        z-index: 20;
        margin-bottom: 0;
    }

    body.is-chart-view .back-to-categories-button {
        min-width: 0;
        padding: 0 14px;
        border-radius: 999px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
        font-size: 13px;
        line-height: 36px;
        height: 36px;
        margin: 0;
    }

    body.is-chart-view .back-to-categories-button .material-icons {
        font-size: 18px;
        margin-right: 4px;
    }

    body.is-chart-view .iframe-stage {
        min-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        overflow-x: hidden;
        background: #ffffff;
    }

    body.is-chart-view iframe {
        width: 100%;
        max-width: 100%;
    }
}

/* Media Queries para responsividad */
@media (max-width: 768px) {
    .main-container {
        padding: 8px;
    }

    body.is-chart-view .main-container {
        padding-left: 0;
        padding-right: 0;
    }

    .categories-container {
        width: 100%;
        max-width: none;
    }

    .mdl-layout__header-row {
        padding: 0 10px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mdl-layout-title {
        font-size: 16px;
        line-height: 1.1;
        white-space: nowrap;
        flex: 1;
        overflow: visible;
        text-overflow: clip;
    }

    .title-desktop {
        display: none;
    }

    .title-mobile {
        display: inline-block;
        overflow: visible;
        text-overflow: clip;
        font-weight: 500;
    }

    .logo {
        height: 26px;
        margin-right: 0;
        padding: 3px;
    }

    .mdl-navigation {
        display: none;
    }

    .mdl-card {
        width: 100%;
        max-width: none;
        margin: 8px auto;
    }

    .info-card {
        max-width: 90%;
    }

    .notes-banner {
        width: 100%;
        margin: 6px auto 16px;
        padding: 12px;
    }

    .notes-banner-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .notes-banner-title {
        font-size: 12px;
        letter-spacing: 0.03em;
    }

    .notes-toggle {
        font-size: 12px;
        padding: 5px 9px;
    }

    .notes-banner-items {
        font-size: 13px;
        gap: 6px 8px;
    }

    .notes-chip {
        padding: 5px 8px;
        font-size: 12px;
    }

    .container {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-top: 10px;
    }

    h2 {
        font-size: 34px;
        line-height: 1.08;
        margin: 0 0 16px;
    }

    h3 {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .category-section {
        margin-bottom: 22px;
    }

    .summary-box {
        padding: 8px 10px 0;
    }

    .summary-section {
        margin: 8px 0 10px;
        padding: 9px 10px;
    }

    .summary-section-header {
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 6px;
    }

    .summary-section-title,
    .summary-section-date {
        font-size: 11px;
    }

    .summary-item {
        grid-template-columns: 40px 1fr 16px;
        gap: 8px;
        padding: 4px 0;
    }

    .summary-badge {
        font-size: 11px;
        padding: 6px 0;
    }

    .summary-item-icon .material-icons {
        font-size: 16px;
    }

    .summary-right {
        grid-template-columns: auto 12px minmax(38px, auto);
        column-gap: 3px;
        font-size: 12px;
    }

    .share-icon-button {
        width: 34px;
        min-width: 34px;
        height: 34px;
    }

    .share-icon-svg {
        width: 18px;
        height: 18px;
    }

    .summary-arrow {
        width: 12px;
    }

    .summary-percent {
        min-width: 38px;
    }

    .iframe-container {
        min-height: calc(100dvh - 72px);
        padding-bottom: 84px;
    }

    body.is-chart-view .iframe-container {
        width: 100vw;
        max-width: 100vw;
        margin-top: 8px;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        padding-left: 0;
        padding-right: 0;
    }

    .iframe-toolbar {
        position: fixed;
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        z-index: 20;
        margin-bottom: 0;
    }

    .back-to-categories-button {
        min-width: 0;
        padding: 0 14px;
        border-radius: 999px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
        font-size: 13px;
        line-height: 36px;
        height: 36px;
    }

    .back-to-categories-button .material-icons {
        font-size: 18px;
        margin-right: 4px;
    }

    .iframe-stage {
        min-height: calc(100dvh - 190px);
    }

    body.is-chart-view .iframe-stage {
        border-radius: 0;
        box-shadow: none;
    }

    body.is-chart-view iframe {
        width: 100vw;
        max-width: 100vw;
    }
}

/* Estilos del logo en la navbar */
.logo {
    height: 40px;
    margin-right: 20px;
    padding: 5px;
    background-color: #ffffff;
    border-radius: 4px;
}
/* Estilos para el contenedor del iframe */
.iframe-container {
    width: 100%;
    min-height: calc(100vh - 80px);
    min-height: calc(100dvh - 80px);
    margin-top: 20px;
    overflow: visible;
}

.iframe-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.back-to-categories-button {
    position: relative;
    z-index: 3;
}

.iframe-stage {
    position: relative;
    height: auto;
    min-height: 420px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #f4fbf6 100%);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

iframe {
    display: block;
    width: 100%;
    height: 420px;
    border: none;
    background: #ffffff;
    opacity: 0;
    transition: opacity 0.25s ease;
}

iframe.is-ready {
    opacity: 1;
}

.iframe-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.94);
    z-index: 1;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.iframe-loading.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.iframe-loading-card {
    max-width: 360px;
    padding: 24px 28px;
    border-radius: 16px;
    text-align: center;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(52, 199, 89, 0.14);
    border: 1px solid rgba(52, 199, 89, 0.16);
}

.iframe-spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto 16px;
    border-radius: 50%;
    border: 4px solid rgba(52, 199, 89, 0.2);
    border-top-color: var(--color-verde-primario);
    animation: spin 0.85s linear infinite;
}

.iframe-loading-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-gris-oscuro);
    margin-bottom: 8px;
}

.iframe-loading-message {
    color: #5f6368;
    line-height: 1.45;
    font-size: 14px;
}

.iframe-loading-message.is-warning {
    color: #8a5b00;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.summary-box{
    padding: 10px 16px 0 16px;
    font-size: 13px;
    color: #333;
}

.shareable-card.is-sharing{
    box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.18), 0 8px 22px rgba(0, 0, 0, 0.16);
}

.share-card-export{
    width: 460px !important;
    max-width: 460px !important;
    margin: 0 !important;
    transform: none !important;
    animation: none !important;
    background: #ffffff !important;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.12) !important;
}

.share-card-export:hover{
    transform: none !important;
}

.share-card-export .summary-box{
    padding-top: 4px;
}

.share-card-export .summary-section{
    padding: 14px 16px;
    background: linear-gradient(180deg, #fbfdfb 0%, #f4faf5 100%);
}

.share-card-export .summary-section-header{
    margin-bottom: 12px;
}

.share-card-export .summary-section-grid{
    gap: 10px;
}

.share-card-export .summary-item{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 4px 2px;
}

.share-card-export .summary-badge{
    flex: 0 0 82px;
    min-width: 82px;
    padding: 8px 0;
}

.share-card-export .summary-item-content{
    flex: 1;
    min-width: 0;
}

.share-card-export .summary-item-icon{
    display: none;
}

.share-card-export .summary-right{
    width: auto;
    flex-shrink: 0;
}

.share-card-export .share-export-hidden{
    display: none !important;
}

.share-card-brand{
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 12px;
    padding: 0 16px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #6f7b74;
}

.summary-section{
    margin: 8px 0 12px;
    padding: 10px 12px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    background: rgba(0,0,0,0.02);
}
.summary-section-header{
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.summary-section-title{
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
}
.summary-section-date{
    color: #666;
    font-size: 12px;
    opacity: 0.8;
}
.summary-section-grid{
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.summary-item{
    display: grid;
    grid-template-columns: 44px 1fr 18px;
    gap: 10px;
    padding: 4px 2px;
    align-items: center;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.summary-item:hover{
    background: rgba(63, 81, 181, 0.06);
}
.summary-item:focus{
    outline: 2px solid rgba(63, 81, 181, 0.28);
    outline-offset: 2px;
}
.summary-item:active{
    transform: translateY(1px);
}
.summary-badge{
    font-weight: 700;
    font-size: 12px;
    text-align: center;
    border-radius: 6px;
    padding: 6px 0;
    color: #fff;
    line-height: 1;
    height: fit-content;
}
.badge-pg{ background: #28a745; }      /* verde */
.badge-pp5{ background: #3f51b5; }     /* azul */
.summary-item-content{
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    min-width: 0;
}
.summary-item-icon{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    opacity: 0.9;
}
.summary-item-icon .material-icons{
    font-size: 18px;
}
.summary-muted{
    color: #666;
    font-size: 12px;
}
.trend-up{ color: #1b8f3a; font-weight: 700; }
.trend-down{ color: #c62828; font-weight: 700; }
.trend-flat{ color: #777; font-weight: 700; }
.trend-placeholder{ visibility: hidden; }
.summary-error{
    color: #b00020;
    font-size: 12px;
    padding: 6px 0;
}
.summary-right{
    display: inline-grid;
    grid-template-columns: auto 14px minmax(44px, auto);
    align-items: center;
    column-gap: 4px;
    line-height: 1.2;
    text-align: right;
    margin-left: auto;
}
.summary-price{
    justify-self: end;
    white-space: nowrap;
}
.summary-trend{
    justify-self: end;
    min-width: 64px;
    white-space: nowrap;
}
.summary-arrow{
    justify-self: end;
    width: 14px;
    text-align: center;
}
.summary-percent{
    justify-self: end;
    min-width: 44px;
    white-space: nowrap;
}
/* En pantallas grandes volvemos a 2 columnas */
@media (min-width: 1200px) {
    .mdl-card {
        width: 320px;
        margin: 12px;
    }
    .category-row {
        justify-content: center;
    }
}

