/* assets/dashboard.css */

/* --- Layout --- */
.dashboard-body { 
    background: #f4f7fa; 
    padding-bottom: 50px; 
    position: relative; /* Context for background */
}
.dash-container { 
    max-width: 1100px; 
    margin: 0 auto; 
    padding: 20px; 
    position: relative;
    z-index: 5; /* Ensure content sits above the floating emojis */
}
.dash-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 30px; 
}

/* --- Baby Chaos Background --- */
#babyChaos {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1; /* Sit above body bg, below content */
    overflow: hidden;
}

.floater {
    position: absolute;
    bottom: -100px; /* Start off screen */
    animation-name: floatUp;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    will-change: transform;
}

@keyframes floatUp {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg);
    }
    100% {
        transform: translateX(var(--drift)) translateY(-120vh) rotate(360deg);
    }
}

/* --- Grid Systems --- */
.dashboard-grid {
    display: grid;
    /* Reduced min-width to 140px to allow 2 columns on mobile */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px; /* Slightly reduced gap for mobile spacing */
    margin-bottom: 20px;
}
.dashboard-grid-mini {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* --- Stat Widgets --- */
.stat-box {
    background: white;
    border-radius: var(--radius);
    padding: 20px; /* Reduced padding slightly for tighter mobile layout */
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}
.stat-box:hover { 
    transform: translateY(-3px); 
}

.stat-label { 
    font-size: 0.75rem; /* Slightly smaller label for mobile fit */
    font-weight: 700; 
    color: #b2bec3; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-bottom: 8px; 
}

.stat-val { 
    font-size: 2.5rem; /* Scaled down slightly to prevent overflow */
    font-weight: 800; 
    color: var(--text); 
    line-height: 1.1; 
}
.mid-val { 
    font-size: 1.5rem; 
    font-weight: 700; 
    color: var(--text); 
}
.mini-stat { 
    font-size: 0.8rem; 
    color: var(--text-light); 
    margin-top: 5px; 
}

.purple-text { color: var(--primary); }
.accent-text { color: var(--accent); }

/* --- Donut Chart --- */
.donut-wrapper { 
    display: flex; 
    flex-direction: column; /* Stack vertically on small cards */
    align-items: center; 
    gap: 10px; 
}
.donut-chart {
    width: 80px; /* Smaller chart for mobile 2-col */
    height: 80px;
    border-radius: 50%;
    background: #eee; /* Fallback */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.donut-hole {
    width: 55px;
    height: 55px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #ddd;
    font-size: 1rem;
}
.donut-legend { 
    text-align: center; 
    font-size: 0.8rem; 
    font-weight: 700; 
    line-height: 1.4; 
}

/* --- Table & Badges --- */
.badge { 
    padding: 4px 12px; 
    border-radius: 20px; 
    font-weight: 700; 
    font-size: 0.8rem; 
}
.badge-boy { background: #e7f5ff; color: #0984e3; }
.badge-girl { background: #fff0f6; color: #e84393; }

.table-wrap { 
    background: white; 
    border-radius: var(--radius); 
    overflow-x: auto; 
    box-shadow: var(--shadow); 
}
table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 1200px; 
}
th { 
    text-align: left; 
    padding: 15px 20px; 
    background: #f8f9fa; 
    color: #636e72; 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    white-space: nowrap; 
}
td { 
    padding: 15px 20px; 
    border-bottom: 1px solid #f1f2f6; 
    vertical-align: middle; 
}
tr:last-child td { border-bottom: none; }
.mt-4 { margin-top: 20px; }

/* --- TV Mode --- */

/* 1. Redefine the variables for Dark Mode */
body.tv-mode {
    --text: #ffffff;
    --text-light: #dfe6e9;
    --bg: #2d3436;
    --card-bg: #2d3436;
}

body.tv-mode .dash-container { max-width: 100%; padding: 40px; }

/* 2. Force backgrounds using the new dark variables */
body.tv-mode .stat-box,
body.tv-mode .table-wrap { 
    background: var(--card-bg); 
    border: 1px solid #444; 
}

/* 3. Fix specific element colors */
body.tv-mode .stat-val, 
body.tv-mode .mid-val, 
body.tv-mode .donut-legend { 
    color: var(--text); 
}

body.tv-mode .donut-hole { 
    background: var(--card-bg); 
    color: #666; 
}

body.tv-mode th { 
    background: #333; 
    color: #aaa; 
}

body.tv-mode td { 
    color: var(--text-light); 
    border-color: #444; 
}