/* Dashboard CSS - Scheibel Clinic Premium Single-Page Design */

:root {
    --c-beige-light: #F8F8F5;
    --c-beige-mid: #D6D2C4;
    --c-taupe: #A69F8B;
    --c-olive: #4E4934;
    --c-black-brand: #212721;
    --c-text-muted: #66665c;
    --transition: all 0.3s ease;
    --radius: 4px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--c-beige-mid);
    /* Theme adjusted to match logo background */
    color: #333;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    /* Single page view */
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* HEADER CENTRADO */
.header {
    margin-bottom: 0.5rem;
}

.header-content-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--c-beige-mid);
}

.logo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.official-logo {
    height: 80px;
    width: auto;
}

.logo-centered {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--c-olive);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.65rem;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-refresh-mini {
    background: none;
    border: 1px solid var(--c-beige-mid);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: var(--transition);
}

.btn-refresh-mini:hover {
    background: var(--c-olive);
    color: white;
}

/* COMPACT FILTERS */
.filter-compact {
    margin-bottom: 1rem;
}

.filter-row {
    background: rgba(255, 255, 255, 0.4);
    /* Glass effect for contrast on darker bg */
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--c-text-muted);
    font-weight: 600;
}

.date-input-mini {
    border: 1px solid #eee;
    padding: 0.3rem;
    font-size: 0.75rem;
    border-radius: 2px;
}

.filter-sep {
    font-size: 0.7rem;
    color: #999;
}

.btn-apply-mini {
    background: var(--c-olive);
    color: white;
    border: none;
    padding: 0.35rem 1rem;
    border-radius: 2px;
    font-size: 0.65rem;
    text-transform: uppercase;
    cursor: pointer;
}

.quick-filters-mini {
    display: flex;
    gap: 0.5rem;
}

.btn-quick-mini {
    background: #f9f9f7;
    border: 1px solid #eee;
    padding: 0.25rem 0.6rem;
    font-size: 0.6rem;
    cursor: pointer;
    border-radius: 2px;
    transition: var(--transition);
}

.btn-quick-mini:hover,
.btn-quick-mini.active {
    background: var(--c-olive);
    color: white;
    border-color: var(--c-olive);
}

/* MAIN GRID */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Important for flex child with overflow */
}

.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: 0;
}

/* FUNNEL V3 - SVG PRECISION */
.funnel-section {
    display: flex;
    justify-content: center;
    padding-top: 0.5rem;
}

.funnel-container-v3 {
    width: 260px;
    height: 400px;
    position: relative;
    margin: 0 auto;
}

.funnel-svg {
    width: 100%;
    height: 100%;
}

.f-stage {
    fill: var(--c-taupe);
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 0.5;
    transition: var(--transition);
}

.f-stage:hover {
    filter: brightness(1.1);
    transform: scaleX(1.02);
    transform-origin: center;
}

.s1 {
    fill: #a19c89;
    /* Darkened for contrast with background */
}

.s2 {
    fill: var(--c-taupe);
}

.s3 {
    fill: #8e8979;
}

.s4 {
    fill: #736e5f;
}

.s5 {
    fill: #5c594c;
}

.s6 {
    fill: var(--c-black-brand);
}

.funnel-labels-v3 {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.f-label-row {
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    /* Matches gap in SVG paths */
}

.f-label-row .lbl {
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white;
    /* Forced white as requested */
    opacity: 0.9;
    margin-bottom: 2px;
}

.f-label-row.r1 .lbl,
.f-label-row.r2 .lbl {
    color: white;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.f-label-row .val {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.r1 .val,
.r2 .val {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.f-label-row.r6 {
    height: 55px;
    margin-top: 0;
}

/* Conversion Bracket V3 */
.conversion-bracket-v3 {
    position: absolute;
    right: -25px;
    bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bracket-arc {
    width: 30px;
    height: 60px;
    border: 1px solid var(--c-beige-mid);
    border-left: 0;
    border-radius: 0 40px 40px 0;
}

.bracket-info {
    display: flex;
    flex-direction: column;
}

.b-lbl {
    font-size: 0.55rem;
    text-transform: uppercase;
    color: var(--c-text-muted);
}

.b-val {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--c-olive);
}

/* CHARTS STACK */
.charts-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

.chart-card {
    background: rgba(255, 255, 255, 0.6);
    /* More transparent cards */
    backdrop-filter: blur(10px);
    padding: 1rem;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chart-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    color: var(--c-black-brand);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-container {
    flex: 1;
    min-height: 0;
}

.charts-row {
    flex: 1;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1rem;
    min-height: 0;
}

/* METRICS GRID - BOTTOM */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    padding: 1.2rem 0 0.5rem 0;
    border-top: 1px solid var(--c-beige-mid);
}

.metric-card {
    text-align: left;
}

.metric-label {
    font-size: 0.55rem;
    color: #555;
    /* Darkened for better contrast */
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.metric-value {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--c-olive);
}

.metric-sublabel {
    font-size: 0.5rem;
    color: #777;
    /* Significantly darkened from #bbb for visibility */
}

/* LOADING */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 248, 245, 0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 25px;
    height: 25px;
    border: 2px solid var(--c-beige-mid);
    border-top: 2px solid var(--c-olive);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
/* RESPONSIVIDADE */

/* Tablets e Telas Médias (< 1100px) */
@media (max-width: 1100px) {
    body, .container {
        height: auto;
        overflow: visible;
    }

    .container {
        padding: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .funnel-section {
        order: 2;
        padding: 2rem 0;
    }

    .charts-stack {
        order: 1;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Celulares (< 768px) */
@media (max-width: 768px) {
    .header-content-centered {
        gap: 0.3rem;
    }

    .official-logo {
        height: 60px;
    }

    .logo-centered {
        font-size: 1.2rem;
        letter-spacing: 2px;
    }

    .filter-row {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .filter-group {
        justify-content: center;
        flex-wrap: wrap;
    }

    .quick-filters-mini {
        justify-content: center;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .chart-card.small-chart {
        min-height: 250px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .metric-card {
        background: rgba(255, 255, 255, 0.4);
        padding: 1rem;
        border-radius: var(--radius);
        backdrop-filter: blur(5px);
    }

    .funnel-container-v3 {
        transform: scale(0.9);
        transform-origin: top center;
        margin-bottom: -20px;
    }
}

/* Telas muito pequenas (< 400px) */
@media (max-width: 400px) {
    .funnel-container-v3 {
        transform: scale(0.75);
        margin-bottom: -80px;
    }

    .logo-centered {
        font-size: 1rem;
    }
}
