@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
    /* Colors - Warm Honey Palette */
    --color-bg: #0f0e0c;
    --color-surface: rgba(255, 255, 255, 0.04);
    --color-surface-hover: rgba(255, 255, 255, 0.07);
    --color-surface-active: rgba(255, 255, 255, 0.10);
    --color-glass: rgba(255, 255, 255, 0.06);
    --color-glass-border: rgba(255, 255, 255, 0.08);

    --color-primary: #f59e0b;
    --color-primary-light: #fbbf24;
    --color-primary-dark: #d97706;
    --color-primary-glow: rgba(245, 158, 11, 0.15);
    --color-primary-subtle: rgba(245, 158, 11, 0.08);

    --color-text: #fafaf9;
    --color-text-secondary: rgba(250, 250, 249, 0.6);
    --color-text-muted: rgba(250, 250, 249, 0.35);

    --color-danger: #ef4444;
    --color-success: #22c55e;
    --color-info: #3b82f6;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px var(--color-primary-glow);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --nav-height: 72px;
    --container-max: 1200px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Ambient background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(245, 158, 11, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(217, 119, 6, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(251, 191, 36, 0.03) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ============================================
   NAVIGATION
   ============================================ */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    background: rgba(15, 14, 12, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--color-glass-border);
    z-index: 1000;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-brand .brand-icon {
    font-size: 1.5rem;
}

.nav-brand span {
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.nav-link {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: var(--color-text);
    background: var(--color-surface-hover);
}

.nav-link--active {
    color: var(--color-primary-light);
}

.nav-link--cta {
    background: var(--color-primary-subtle);
    color: var(--color-primary-light);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.nav-link--cta:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--color-primary-light);
    box-shadow: var(--shadow-glow);
}

/* Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: var(--space-sm);
    background: none;
    border: none;
    z-index: 1001;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all var(--transition-base);
    transform-origin: center;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================
   LAYOUT
   ============================================ */
.page {
    padding-top: var(--nav-height);
    min-height: 100vh;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

.section {
    padding: var(--space-3xl) 0;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: calc(100vh - var(--nav-height));
    padding: var(--space-4xl) var(--space-xl);
    position: relative;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-primary-subtle);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-primary-light);
    margin-bottom: var(--space-xl);
    animation: fadeInDown 0.6s ease-out;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: var(--space-lg);
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero-title .gradient-text {
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 50%, var(--color-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--color-text-secondary);
    max-width: 500px;
    margin-bottom: var(--space-2xl);
    font-weight: 400;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 28px;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #000;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.35);
}

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

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-glass-border);
}

.btn-secondary:hover {
    background: var(--color-surface-hover);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    font-size: 1.1em;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition-base);
}

.card:hover {
    background: var(--color-surface-hover);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1.4rem;
}

.card-icon--amber {
    background: var(--color-primary-subtle);
}

.card-icon--green {
    background: rgba(34, 197, 94, 0.1);
}

.card-icon--blue {
    background: rgba(59, 130, 246, 0.1);
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-xs);
}

.card-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    padding: var(--space-2xl) 0 var(--space-lg);
}

.page-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-description {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    margin-top: var(--space-xs);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.breadcrumb a:hover {
    color: var(--color-primary-light);
}

.breadcrumb-separator {
    opacity: 0.4;
}

/* ============================================
   HIVE TABLE / CARDS
   ============================================ */
.hive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-md);
}

.hive-card {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.hive-card:hover {
    background: var(--color-surface-hover);
    border-color: rgba(245, 158, 11, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px var(--color-primary-glow);
}

.hive-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hive-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.1rem;
    font-weight: 600;
}

.hive-name .icon {
    font-size: 1.3rem;
}

.hive-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.hive-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

.hive-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.hive-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hive-metric-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.hive-metric-value {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.hive-metric-value .unit {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text-secondary);
    margin-left: 2px;
}

.hive-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-glass-border);
}

.hive-time {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* ============================================
   CHART
   ============================================ */
.chart-container {
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#chart-weight-by-date {
    width: 100%;
    min-height: 420px;
}

/* ============================================
   LOGIN FORM
   ============================================ */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--nav-height));
    padding: var(--space-xl);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-glass);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: fadeInUp 0.5s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    display: block;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.95rem;
    color: var(--color-text);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
    background: var(--color-surface-hover);
}

.login-btn {
    width: 100%;
    margin-top: var(--space-lg);
}

/* ============================================
   FLASH MESSAGES
   ============================================ */
.flash-container {
    position: fixed;
    top: calc(var(--nav-height) + var(--space-md));
    right: var(--space-xl);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 400px;
    width: 100%;
}

.flash {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: slideInRight 0.4s ease-out;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    border: 1px solid;
}

.flash-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.flash-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.flash-info {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-4xl) var(--space-xl);
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.1rem;
    font-weight: 500;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    padding: var(--space-2xl) 0;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--color-glass-border);
    margin-top: var(--space-3xl);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Stagger animation helper */
.animate-in {
    animation: fadeInUp 0.5s ease-out both;
}

.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.06s; }
.animate-in:nth-child(3) { animation-delay: 0.12s; }
.animate-in:nth-child(4) { animation-delay: 0.18s; }
.animate-in:nth-child(5) { animation-delay: 0.24s; }
.animate-in:nth-child(6) { animation-delay: 0.30s; }

/* ============================================
   RESPONSIVE — TABLET
   ============================================ */
@media screen and (max-width: 768px) {
    :root {
        --nav-height: 64px;
    }

    .nav {
        padding: 0 var(--space-md);
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        flex-direction: column;
        align-items: stretch;
        padding: calc(var(--nav-height) + var(--space-3xl)) var(--space-lg) var(--space-xl);
        background: rgba(15, 14, 12, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-left: 1px solid var(--color-glass-border);
        transition: right var(--transition-base);
        gap: var(--space-md);
    }

    .nav-links.open {
        right: 0;
    }

    .nav-link {
        padding: 16px var(--space-md);
        font-size: 1.1rem;
        border-radius: var(--radius-md);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .nav-link:last-child {
        border-bottom: none;
        margin-top: var(--space-md);
    }

    /* Overlay */
    .nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .nav-overlay.show {
        display: block;
    }

    .container {
        padding: 0 var(--space-md);
    }

    .hero {
        padding: var(--space-2xl) var(--space-md);
        min-height: calc(80vh - var(--nav-height));
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }

    .hero-actions .btn {
        width: 100%;
    }

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

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

    .flash-container {
        right: var(--space-md);
        left: var(--space-md);
        max-width: none;
    }

    .page-header-content {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   RESPONSIVE — SMALL PHONE
   ============================================ */
@media screen and (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .hive-card-body {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: var(--space-lg);
    }

    #chart-weight-by-date {
        min-height: 300px;
    }
}
