/*
 * CHARTED INTEREST - Dashboard Styles
 * Styles specific to interactive dashboard pages
 * Requires: variables.css (imported via main.css)
 */


/* ===========================================
   DASHBOARD HEADER
   =========================================== */

.dashboard-header {
    background: var(--brand-teal);
    padding: var(--space-xl) var(--container-padding);
    text-align: center;
    color: white;
    position: relative;
}

/* Optional: Background image overlay */
.dashboard-header.with-image {
    background-image: linear-gradient(rgba(11, 79, 108, 0.85), rgba(11, 79, 108, 0.95)), 
                      var(--header-bg-image);
    background-size: cover;
    background-position: center;
}

.dashboard-header h1 {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: var(--weight-black);
    margin: 0;
    letter-spacing: -0.02em;
}

.dashboard-header p {
    font-size: var(--text-sm);
    opacity: 0.9;
    margin-top: var(--space-xs);
    font-weight: var(--weight-normal);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Back to Home Link */
.dashboard-back {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: color var(--transition-fast);
}

.dashboard-back:hover {
    color: white;
}


/* ===========================================
   DASHBOARD CONTAINER
   =========================================== */

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg) var(--container-padding);
}


/* ===========================================
   DASHBOARD GRID
   =========================================== */

.dashboard-grid {
    display: grid;
    gap: var(--space-sm);
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas: 
        "controls controls controls"
        "kpi1 kpi2 kpi3"
        "chart chart receipt";
    align-items: start;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "controls"
            "kpi1"
            "kpi2"
            "kpi3"
            "chart"
            "receipt";
    }
}


/* ===========================================
   DASHBOARD CARDS (override base card styles)
   =========================================== */

.dashboard-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
}

/* Card Label */
.dashboard-card .card-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    color: var(--text-pencil);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}

/* Card Value (big numbers) */
.card-value {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: var(--weight-bold);
    color: var(--text-ink);
    margin: 0;
    line-height: var(--leading-tight);
}

.card-sub {
    font-size: var(--text-xs);
    color: var(--text-faint);
    margin-top: var(--space-xs);
}

/* Trend Colors for Values */
.trend-val {
    font-size: 2.2rem;
}

.trend-val.trend-up {
    color: var(--color-negative);
    background: none;
    border: none;
    padding: 0;
}

.trend-val.trend-down {
    color: var(--color-positive);
    background: none;
    border: none;
    padding: 0;
}


/* ===========================================
   CONTROLS CARD
   =========================================== */

.controls-card {
    grid-area: controls;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
}

.controls-title {
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    color: var(--text-ink);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Dropdown Select */
.family-selector select {
    padding: var(--space-sm) var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    background-color: var(--bg-paper);
    cursor: pointer;
    font-weight: var(--weight-medium);
    color: var(--text-ink);
    outline: none;
    transition: border-color var(--transition-fast);
}

.family-selector select:hover {
    border-color: var(--text-pencil);
}

.family-selector select:focus {
    border-color: var(--brand-orange);
}

/* Toggle Button */
.toggle-btn {
    background: var(--bg-muted);
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-ink);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.toggle-btn:hover {
    background: var(--border-color);
}

.toggle-btn.active {
    background: var(--text-ink);
    color: white;
}


/* ===========================================
   EXPANDABLE MENU
   =========================================== */

.menu-container {
    display: none;
    grid-column: 1 / -1;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-top: calc(var(--space-sm) * -1);
    margin-bottom: var(--space-sm);
    box-shadow: var(--shadow-sm);
}

.menu-container.show {
    display: block;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.category-title {
    font-size: var(--text-xs);
    text-transform: uppercase;
    color: var(--text-pencil);
    margin-bottom: var(--space-sm);
    font-weight: var(--weight-bold);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-xs);
    letter-spacing: 0.5px;
}

.menu-item {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-sm);
    cursor: pointer;
}

.menu-item input[type="checkbox"] {
    margin-right: var(--space-sm);
    accent-color: var(--brand-orange);
    width: 16px;
    height: 16px;
}

.item-label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}


/* ===========================================
   KPI CARDS
   =========================================== */

.kpi-1 { grid-area: kpi1; }
.kpi-2 { grid-area: kpi2; }
.kpi-3 { grid-area: kpi3; }


/* ===========================================
   CHART SECTION
   =========================================== */

.chart-section {
    grid-area: chart;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.chart-title {
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    margin: 0;
}

.chart-subtitle {
    font-size: var(--text-sm);
    color: var(--text-pencil);
}

.chart-wrapper {
    flex-grow: 1;
    position: relative;
    min-height: 400px;
}


/* ===========================================
   RECEIPT VISUALIZATION
   =========================================== */

.receipt-wrapper {
    grid-area: receipt;
    background: transparent;
    box-shadow: none;
    border: none;
    display: flex;
    justify-content: center;
    padding: 0;
}

.receipt-paper {
    background: #fff;
    width: 100%;
    max-width: 380px;
    padding: var(--space-lg) var(--space-lg) var(--space-xl) var(--space-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: #333;
}

/* Jagged Bottom Edge */
.receipt-paper::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 0;
    height: 10px;
    width: 100%;
    background: 
        linear-gradient(45deg, transparent 33.333%, #ffffff 33.333%, #ffffff 66.667%, transparent 66.667%), 
        linear-gradient(-45deg, transparent 33.333%, #ffffff 33.333%, #ffffff 66.667%, transparent 66.667%);
    background-size: 20px 20px;
    background-position: 0 0;
}

.receipt-top {
    text-align: center;
    border-bottom: 1px dashed #ccc;
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
}

.receipt-logo {
    font-weight: var(--weight-bold);
    font-size: var(--text-base);
    text-transform: uppercase;
    letter-spacing: -0.5px;
    margin-bottom: var(--space-xs);
}

.receipt-meta {
    font-size: var(--text-xs);
    color: #666;
    display: flex;
    justify-content: space-between;
}

.receipt-meta-center {
    justify-content: center;
    font-weight: var(--weight-bold);
    margin-top: var(--space-xs);
}

.receipt-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.receipt-name {
    max-width: 70%;
}

.receipt-total-section {
    border-top: 2px solid #000;
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
}

.receipt-total-line {
    display: flex;
    justify-content: space-between;
    font-weight: var(--weight-bold);
    font-size: var(--text-lg);
}

.receipt-footer {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: var(--text-xs);
    color: #888;
}


/* ===========================================
   SHARE SECTION
   =========================================== */

.share-section {
    grid-column: 1 / -1;
    text-align: center;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    font-family: var(--font-sans);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    border: none;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.share-btn:active {
    transform: translateY(0);
}

.share-primary {
    background: linear-gradient(135deg, var(--brand-orange) 0%, #E56B1A 100%);
    color: white;
    font-size: var(--text-base);
    padding: var(--space-md) var(--space-xl);
    font-weight: var(--weight-bold);
    box-shadow: var(--shadow-md);
    width: 100%;
    justify-content: center;
}

.share-primary:hover {
    background: linear-gradient(135deg, #E56B1A 0%, #D65F15 100%);
    box-shadow: var(--shadow-lg);
}

.share-download {
    background: var(--brand-orange);
    color: white;
}

.share-download:hover {
    background: #E56B1A;
}

.share-download-alt {
    background: var(--bg-muted);
    color: var(--text-ink);
    border: 1px solid var(--border-color);
}

.share-download-alt:hover {
    background: var(--border-color);
}

.share-x {
    background: #000000;
    color: white;
}

.share-x:hover {
    background: #1A1A1A;
}

.share-linkedin {
    background: #0A66C2;
    color: white;
}

.share-linkedin:hover {
    background: #095196;
}

.share-bluesky {
    background: #1185FE;
    color: white;
}

.share-bluesky:hover {
    background: #0E6FD4;
}

.share-facebook {
    background: #1877F2;
    color: white;
}

.share-facebook:hover {
    background: #145DBF;
}

.share-email {
    background: var(--text-pencil);
    color: white;
}

.share-email:hover {
    background: var(--text-ink);
}

.copy-feedback {
    display: none;
    margin-top: var(--space-md);
    padding: var(--space-sm);
    background: var(--color-positive);
    color: white;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

@media (max-width: 600px) {
    .share-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .share-btn {
        justify-content: center;
    }
}


/* ===========================================
   DASHBOARD FOOTER
   =========================================== */

.dashboard-footer {
    margin-top: var(--space-xl);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-pencil);
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-lg);
}

.dashboard-footer a {
    color: var(--text-ink);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-faint);
}

.dashboard-footer a:hover {
    color: var(--brand-orange);
    border-bottom-color: var(--brand-orange);
}
