/* AuraFit Coach Dashboard — Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

:root {
    --bg: #020617;
    --surface: #0E1223;
    --card: #0F172A;
    --card-hover: #131d36;
    --border: #1E293B;
    --primary: #22C55E;
    --primary-dim: rgba(34, 197, 94, 0.15);
    --danger: #EF4444;
    --danger-dim: rgba(239, 68, 68, 0.15);
    --warning: #F59E0B;
    --warning-dim: rgba(245, 158, 11, 0.15);
    --text: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: 200ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background effects */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(34, 197, 94, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(59, 130, 246, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Grain texture */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
}

/* Layout */
.app {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: 64px 1fr;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.header__logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.header__logo span {
    color: var(--text);
    font-weight: 400;
}

.header__user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.header__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* Sidebar */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar__title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 8px 12px;
    margin-bottom: 4px;
}

.sidebar__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
    color: var(--text-secondary);
}

.sidebar__item:hover {
    background: var(--card);
    color: var(--text);
}

.sidebar__item--active {
    background: var(--primary-dim);
    color: var(--primary);
}

.sidebar__item--alert {
    position: relative;
}

.sidebar__badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    animation: pulse 2s infinite;
}

.sidebar__streak {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

/* Main content */
.main {
    padding: 24px;
    overflow-y: auto;
}

/* Overview cards */
.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.08);
    border-color: var(--primary);
}

.stat-card__label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-card__value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
}

.stat-card__value--danger {
    color: var(--danger);
}

.stat-card__value--warning {
    color: var(--warning);
}

/* Section */
.section {
    margin-bottom: 32px;
}

.section__title {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Alert list */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    opacity: 0;
    transform: translateX(-10px);
    animation: fadeInLeft 0.4s ease forwards;
}

.alert-item:nth-child(1) { animation-delay: 0.1s; }
.alert-item:nth-child(2) { animation-delay: 0.2s; }
.alert-item:nth-child(3) { animation-delay: 0.3s; }
.alert-item:nth-child(4) { animation-delay: 0.4s; }

.alert-item--danger {
    border-left: 3px solid var(--danger);
}

.alert-item--warning {
    border-left: 3px solid var(--warning);
}

.alert-item__icon {
    font-size: 18px;
}

.alert-item__text {
    flex: 1;
    color: var(--text-secondary);
}

.alert-item__client {
    font-weight: 500;
    color: var(--text);
}

.alert-item__date {
    font-size: 12px;
    color: var(--text-muted);
}

/* Client detail */
.client-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.client-header__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}

.client-header__info h2 {
    font-size: 18px;
    margin-bottom: 4px;
}

.client-header__meta {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 16px;
}

.client-header__meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.2s;
}

.chart-card:nth-child(2) {
    animation-delay: 0.3s;
}

.chart-card__title {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.chart-card canvas {
    width: 100% !important;
    height: 200px !important;
}

/* Food diary */
.food-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.food-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.food-item__icon {
    font-size: 20px;
}

.food-item__desc {
    flex: 1;
    font-size: 14px;
}

.food-item__kcal {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
}

/* Compliance bar */
.compliance-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.compliance-bar__fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}

.compliance-bar__fill--good { background: var(--primary); }
.compliance-bar__fill--warning { background: var(--warning); }
.compliance-bar__fill--danger { background: var(--danger); }

/* Login screen */
.login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 24px;
    position: relative;
    z-index: 1;
}

.login-screen__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.login-screen__subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: -16px;
}

.login-screen__widget {
    margin-top: 16px;
}

/* Animations */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes countUp {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* Responsive */
@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: 64px auto 1fr;
    }

    .sidebar {
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 12px;
    }

    .sidebar__title {
        display: none;
    }

    .sidebar__item {
        white-space: nowrap;
        padding: 8px 12px;
    }

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

    .main {
        padding: 16px;
    }

    .overview-cards {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utility */
.hidden { display: none !important; }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
