/* ========================================
   STATISTICS PAGE STYLES
   ======================================== */

/* Inherit variables from dashboard.css for consistency */
/* Ensure dashboard.css is linked BEFORE this file in the HTML */

html {
    background-color: var(--wood-light); /* QUICK FIX: Prevents white flash on load */
}

body {
    background-color: var(--wood-light); /* Matching background */
}

.stats-container {
    padding: 1.5rem 1rem 8rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.main-content {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
    grid-template-areas:
        "chart"
        "insights"
        "history";
}

@media (min-width: 968px) {
    .main-content {
        grid-template-columns: 2fr 1fr;
        grid-template-areas:
            "chart insights"
            "history history";
    }
}

.stats-card {
    background: var(--bg-primary); /* FIX: Reverted to the correct background variable */
    border: 3px solid var(--wood-dark);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transform: rotate(-0.5deg);
    position: relative; /* This is needed for z-index on children to work correctly */
}

/* FIX: Added grid-area assignments and z-index to ensure proper stacking */
.chart-card {
    grid-area: chart;
    z-index: 5;
}
.insights-card {
    grid-area: insights;
    z-index: 1;
}
.history-card {
    grid-area: history;
    z-index: 1;
}


/* FIX: New flex container for the card title and info button */
.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 3px solid var(--wood-dark);
    border-radius: 1rem 1rem 0 0;
}

.card-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 2rem;
    color: var(--wood-dark);
    text-shadow: 1px 1px 0 rgba(255,255,255,0.2);
    margin: 0; /* Reset margin as it's now in a flex container */
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
}

/* Chart Controls & Custom Dropdown */
.chart-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-family: 'Nunito', sans-serif;
    transform: rotate(0.5deg); /* Counter-rotate the card's tilt */
    position: relative;
    z-index: 10;
}

.chart-controls label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.custom-select-wrapper {
    position: relative;
    user-select: none;
    display: inline-block;
}

.custom-select {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 3px solid var(--wood-dark);
    border-radius: 12px;
    background-color: var(--paper-white);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
    font-size: 1.2rem;
    font-family: 'Patrick Hand', cursive;
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
    background-color: var(--bg-secondary);
    border-radius: 9px;
    transition: box-shadow 0.2s ease;
}

.custom-select.open .custom-select-trigger {
    box-shadow: 0 0 5px rgba(100,150,100,0.5);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* FIX: Removed the animating triangle */
.custom-select-trigger::after {
    display: none;
}

.custom-options {
    position: absolute;
    top: 100%;
    left: -3px; 
    right: -3px; 
    border: 3px solid var(--wood-dark);
    border-top: 0;
    background-color: var(--bg-primary); 
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    z-index: 100;
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.2);
    max-height: 150px;
    overflow-y: auto;
    
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.custom-options::-webkit-scrollbar {
    display: none;
}

.custom-select.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.custom-option {
    position: relative;
    display: block;
    padding: 0.75rem 1.25rem;
    font-size: 1.1rem;
    font-family: 'Special Elite', monospace;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-bottom: 1px dashed var(--border-color);
}
.custom-option:last-of-type {
    border-bottom: 0;
}

.custom-option:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.custom-option.selected {
    color: var(--brand-primary);
    font-weight: bold;
    background-color: var(--bg-secondary);
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Reusable Data Gate Styles */
.data-gate {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--border-color) 100%);
    color: var(--text-primary);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    border: 2px solid var(--wood-dark);
    border-bottom: 5px solid var(--wood-dark);
    max-width: 400px;
    margin: 5px auto 0;
    transform: rotate(0.5deg); /* Counter-rotate the card's tilt */
}

.data-gate-icon {
    background: var(--paper-white, #fdfaf2);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    border: 2px solid var(--wood-dark);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    font-size: 1.8rem;
}

.data-gate-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--brand-primary);
}

.data-gate-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.data-gate-text {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Insights Styles */
.insights-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.insight-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    font-family: 'Special Elite', monospace;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1.1rem;
    line-height: 1.6;
    position: relative;
    border-bottom-width: 5px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.insight-icon {
   font-size: 2rem;
   flex-shrink: 0;
}

.insight-text {
    flex-grow: 1;
}

/* Purchase History Styles */
.purchase-history-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px; /* For scrollbar */
    margin: 0 -10px;
    padding-left: 10px;
}

/* Custom scrollbar for history */
.purchase-history-list::-webkit-scrollbar {
    width: 8px;
}
.purchase-history-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}
.purchase-history-list::-webkit-scrollbar-thumb {
    background: var(--wood-dark);
    border-radius: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 2px dashed var(--border-color);
    font-family: 'Special Elite', monospace;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.history-item-details {
    flex-grow: 1;
}

.history-item-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.history-item-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.history-item-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--brand-primary);
}

/* --- FIX: Tooltip and Info Button Styles --- */

.info-tooltip-button {
    background: var(--brand-primary);
    border: 2px solid var(--wood-dark);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 3px 0 var(--wood-dark), 0 4px 6px rgba(0,0,0,0.2);
    transform: rotate(0.5deg); /* Match counter-rotation */
    flex-shrink: 0;
}

.info-tooltip-button:hover {
    transform: translateY(-2px) rotate(0.5deg);
    box-shadow: 0 5px 0 var(--wood-dark), 0 6px 8px rgba(0,0,0,0.2);
    background: var(--brand-primary-dark, #4a9a5a);
}

.info-tooltip-button:active {
    transform: translateY(1px) rotate(0.5deg);
    box-shadow: 0 1px 0 var(--wood-dark), 0 2px 4px rgba(0,0,0,0.2);
}

.info-tooltip-button svg {
    width: 16px;
    height: 16px;
    stroke: white;
    stroke-width: 3;
}

/* --- NEW: View Toggle and Enhanced Header Styles --- */

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-toggle-group {
    display: flex;
    background: var(--bg-secondary);
    border: 2px solid var(--wood-dark);
    border-radius: 12px;
    padding: 2px;
}

.view-toggle-btn {
    background: transparent;
    border: none;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-secondary);
}

.view-toggle-btn.active {
    background: var(--paper-white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.view-toggle-btn.active svg {
    stroke: var(--brand-primary);
}

.view-toggle-btn:hover:not(.active) {
    background: rgba(88, 129, 87, 0.1);
}

.chart-view {
    display: block;
}

.chart-view.hidden {
    display: none;
}

/* --- NEW: Heatmap Styles --- */

.heatmap-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.legend-gradient {
    width: 80px;
    height: 10px;
    background: linear-gradient(to right, 
        var(--bg-secondary) 0%, 
        #c8e6c9 25%, 
        #81c784 50%, 
        #4caf50 75%, 
        #2e7d32 100%);
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.heatmap-period {
    display: flex;
    gap: 0.5rem;
}

.period-btn {
    padding: 0.4rem 0.8rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.period-btn.active {
    background: var(--brand-primary);
    border-color: var(--wood-dark);
    color: white;
}

.period-btn:hover:not(.active) {
    background: var(--bg-primary);
    border-color: var(--wood-dark);
}

.spending-heatmap {
    position: relative;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.heatmap-month-labels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 0.5rem;
    padding: 0 28px;
}

.heatmap-month-label {
    font-family: 'Special Elite', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: left;
}

.heatmap-day-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 0.5rem;
    padding-left: 28px;
}

.heatmap-day-label {
    font-family: 'Nunito', sans-serif;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heatmap-weeks {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.heatmap-week {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    gap: 2px;
    min-width: 22px;
}

.heatmap-cell {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.heatmap-cell.empty {
    background: transparent;
    cursor: default;
}

.heatmap-cell.no-spend {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

.heatmap-cell.low-spend {
    background: #c8e6c9;
    border-color: #a5d6a7;
}

.heatmap-cell.med-spend {
    background: #81c784;
    border-color: #66bb6a;
}

.heatmap-cell.high-spend {
    background: #4caf50;
    border-color: #43a047;
}

.heatmap-cell.max-spend {
    background: #2e7d32;
    border-color: #1b5e20;
}

.heatmap-cell:hover:not(.empty) {
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 10;
    border-color: var(--wood-dark);
}

.heatmap-tooltip {
    position: fixed;
    background: var(--paper-white, #fdfaf2);
    background-color: #fdfaf2; /* Solid fallback */
    border: 2px solid var(--wood-dark);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10000; /* Very high z-index to ensure it's on top */
    pointer-events: none;
    opacity: 1; /* Ensure full opacity */
}

.heatmap-tooltip.hidden {
    display: none;
}

.tooltip-date {
    font-family: 'Patrick Hand', cursive;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tooltip-amount {
    font-family: 'Special Elite', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--brand-primary);
    margin-top: 0.25rem;
}

/* --- NEW: What-If Scenario Styles --- */

.what-if-controls {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.what-if-controls.hidden {
    display: none;
}

.what-if-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.what-if-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.what-if-toggle {
    padding: 0.4rem 1rem;
    background: var(--paper-white);
    border: 2px solid var(--wood-dark);
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.what-if-toggle.active {
    background: var(--brand-primary);
    color: white;
}

.what-if-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.what-if-panel {
    animation: slideDown 0.3s ease-out;
}

.what-if-panel.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.what-if-slider-group {
    margin-bottom: 1.5rem;
}

.what-if-slider-group label {
    display: block;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.what-if-slider-group label span {
    color: var(--brand-primary);
    font-family: 'Special Elite', monospace;
    font-size: 1.2rem;
    margin-left: 0.5rem;
}

.spending-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-primary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.spending-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-primary);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.spending-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-primary);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.spending-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.spending-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.what-if-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.what-if-stat {
    padding: 0.75rem;
    background: var(--paper-white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-label {
    display: block;
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.what-if-helper {
    background: var(--brand-light, #e8f5e9);
    border: 1px dashed var(--brand-primary);
    border-radius: 8px;
    padding: 0.6rem;
    margin-bottom: 1rem;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.what-if-title span {
    font-family: 'Special Elite', monospace;
}

.stat-value small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
    font-weight: normal;
}

.projection-tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0.5deg); /* Counter-rotate */
    z-index: 1000;
    animation: tooltipBounceIn 0.5s ease-out;
    max-width: 90%;
    width: 320px; /* Made smaller */
}

@keyframes tooltipBounceIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotate(0.5deg);
    }
    70% {
        transform: translate(-50%, -50%) scale(1.05) rotate(0.5deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0.5deg);
    }
}

.tooltip-paper {
    background-color: var(--bg-primary); /* FIX: Set solid background color */
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 20px,
            rgba(88, 129, 87, 0.03) 20px,
            rgba(88, 129, 87, 0.03) 21px
        );
    border: 3px solid var(--wood-dark);
    border-radius: 12px;
    padding: 1rem; /* Made smaller */
    position: relative;
    transform: rotate(-1deg);
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.2),
        inset 0 0 30px rgba(88, 129, 87, 0.05);
}

.tooltip-tape {
    position: absolute;
    top: -15px;
    left: 40%;
    transform: rotate(-5deg);
    width: 80px;
    height: 30px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px dashed rgba(0,0,0,0.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tooltip-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--brand-primary);
    border: 2px solid var(--wood-dark);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: white;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 5;
}

.tooltip-close:hover {
    transform: rotate(90deg);
    background: #d32f2f;
}

.tooltip-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.4rem; /* Made smaller */
    color: var(--wood-dark);
    margin: 0 0 0.75rem 0; /* Reduced bottom margin */
    text-align: center;
    padding: 0 28px; /* FIX: Added padding to avoid overlap with close button */
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Reduced gap */
}

.tooltip-section {
    display: flex;
    gap: 0.6rem; /* Reduced gap */
    align-items: flex-start;
    background: var(--bg-secondary);
    padding: 0.6rem; /* Reduced padding */
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.tooltip-icon {
    font-size: 1.4rem; /* Made smaller */
    flex-shrink: 0;
}

.tooltip-text {
    flex: 1;
    font-family: 'Nunito', sans-serif;
}

.tooltip-text strong {
    display: block;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.tooltip-text p {
    margin: 0;
    font-size: 0.85rem; /* Made smaller */
    color: var(--text-secondary);
    line-height: 1.4;
}

.tooltip-cta {
    background: var(--brand-light, #e8f5e9);
    border: 2px dashed var(--brand-primary);
    border-radius: 8px;
    padding: 0.6rem; /* Reduced padding */
    margin-top: 0.5rem;
    text-align: center;
}

.tooltip-cta p {
    margin: 0;
    font-family: 'Special Elite', monospace;
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* MODAL & DELETE ACCOUNT STYLES FROM DASHBOARD.CSS */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(8px); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 150; 
    opacity: 0; 
    transition: opacity 0.3s ease; 
    pointer-events: none; 
}
.modal-overlay:not(.hidden) { 
    opacity: 1; 
    pointer-events: auto; 
}
.pfp-modal { 
    background-color: var(--bg-primary); 
    border-radius: 1.5rem; 
    padding: 2rem; 
    text-align: center; 
    width: 90%; 
    max-width: 400px; 
    position: relative; 
    transform: scale(0.95); 
    transition: transform 0.3s ease; 
}
.modal-overlay:not(.hidden) .pfp-modal { 
    transform: scale(1); 
}
.pfp-modal h2 { 
    margin-top: 0; 
    font-family: 'Patrick Hand', cursive; 
    font-size: 2rem; 
}
.pfp-preview { 
    width: 128px; 
    height: 128px; 
    border-radius: 50%; 
    border: 3px solid var(--border-color); 
    margin: 1rem auto; 
    object-fit: cover; 
}
.pfp-buttons { 
    display: flex; 
    gap: 1rem; 
    margin-top: 1.5rem; 
}

.pfp-button {
    flex: 1;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    border-style: solid;
    border-width: 2px;
    cursor: pointer;
    transition: all 0.15s ease-out;
    font-size: 0.9rem;
    border-bottom-width: 5px;
}

.pfp-button:hover {
    transform: translateY(-2px);
    border-bottom-width: 7px;
}

.pfp-button:active {
    transform: translateY(1px);
    border-bottom-width: 2px;
    transition-duration: 0.05s;
}

.upload-button {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--wood-dark);
}

.upload-button:hover {
    background-color: #f7f2e5;
}

.save-button {
    background-color: var(--brand-secondary);
    color: white;
    border-color: #388E3C;
}
.save-button:hover {
    background-color: var(--brand-primary);
}

#pfp-upload-input { display: none; }
.close-button { 
    position: absolute; 
    top: 10px; 
    right: 15px; 
    background: none; 
    border: none; 
    color: var(--text-secondary); 
    font-size: 2rem; 
    cursor: pointer; 
}
.error-message { 
    color: #c0392b; 
    font-weight: 500; 
    margin-top: 1rem; 
    min-height: 1.2em; 
}

.pfp-modal .form-group.bio-group {
    text-align: center;
    margin: 1.5rem 0;
}
.pfp-modal .form-group.bio-group label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Patrick Hand', cursive;
    font-size: 1.5rem;
}
.pfp-modal textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: 'Nunito', sans-serif;
    color: var(--text-primary);
    resize: vertical;
    min-height: 60px;
    transition: all 0.15s ease-out;
    background: var(--bg-secondary);
    border: 2px solid var(--wood-dark);
    border-radius: 12px;
    border-bottom: 5px solid var(--wood-dark);
    box-shadow: inset 0 -2px 1px rgba(0,0,0,0.1);
}
.pfp-modal textarea:focus {
    outline: none;
    background-color: #fff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 0 0 3px rgba(76, 175, 80, 0.4);
    border-bottom-width: 5px;
}
.pfp-modal textarea.bio-warning:focus {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 0 0 3px rgba(240, 165, 0, 0.5);
}
.pfp-modal textarea.bio-danger:focus {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06), 0 0 0 3px rgba(211, 47, 47, 0.5);
}
.pfp-modal textarea:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.2);
}

.delete-account-btn {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease-out;
    background: linear-gradient(180deg, #e57373 0%, #d32f2f 100%);
    border: 2px solid #a02424;
    border-radius: 12px;
    border-bottom: 5px solid #a02424;
    box-shadow: inset 0 -2px 1px rgba(0,0,0,0.2);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.delete-account-btn:hover {
    background: linear-gradient(180deg, #ef9a9a 0%, #e57373 100%);
    transform: translateY(-2px);
    border-bottom-width: 7px;
}
.delete-account-btn:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.3);
    transition-duration: 0.05s;
}

#delete-confirm-button {
    background-color: var(--brand-danger) !important;
    border-color: #a02424 !important;
}
#delete-confirm-button:hover {
    background-color: #e57373 !important;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .card-header-actions {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
    }
    
    .view-toggle-group {
        order: -1;
        align-self: flex-start;
    }
    
    .heatmap-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .what-if-results {
        grid-template-columns: 1fr;
    }
    
    .heatmap-weeks {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 640px) {
    .stats-container {
        padding: 1rem 0.5rem 7rem 0.5rem;
    }
    .stats-card {
        padding: 1rem;
        transform: none;
    }
    .card-title {
        font-size: 1.5rem;
    }
    .chart-container {
        height: 250px;
    }
    .projection-tooltip {
        width: 320px;
    }
    
    .tooltip-paper {
        padding: 1rem;
    }
    
    .tooltip-title {
        font-size: 1.25rem;
    }
    
    .tooltip-section {
        padding: 0.5rem;
    }
    
    .tooltip-icon {
        font-size: 1.25rem;
    }
}