/* ============================================
   JENSTEJN ODPADY - Industrial Utilitarian CSS
   Municipal waste. No nonsense.
   ============================================ */

/* --- Design Tokens --- */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #0c1322;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-surface: #1a2332;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-green: #16a34a;
    --accent-green-hover: #15803d;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-yellow-warning: #fbbf24;

    /* Waste type palette */
    --waste-mixed: #6b7280;
    --waste-mixed-bg: rgba(107, 114, 128, 0.12);
    --waste-mixed-border: rgba(107, 114, 128, 0.4);
    --waste-bio: #92400e;
    --waste-bio-bg: rgba(146, 64, 14, 0.12);
    --waste-bio-border: rgba(146, 64, 14, 0.4);
    --waste-paper: #2563eb;
    --waste-paper-bg: rgba(37, 99, 235, 0.12);
    --waste-paper-border: rgba(37, 99, 235, 0.4);
    --waste-plastic: #ca8a04;
    --waste-plastic-bg: rgba(202, 138, 4, 0.12);
    --waste-plastic-border: rgba(202, 138, 4, 0.4);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 9999px;
}

/* --- Base --- */
* {
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent overscroll bounce on iOS */
html {
    overscroll-behavior: none;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: var(--radius-pill);
}

/* --- Typography --- */
.font-heading {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
}

.font-body {
    font-family: 'DM Sans', sans-serif;
}

/* --- Card fade-in animation --- */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-animate {
    animation: fadeSlideIn 0.35s ease-out both;
}

/* Staggered delays for cards */
.card-delay-0 { animation-delay: 0ms; }
.card-delay-1 { animation-delay: 80ms; }
.card-delay-2 { animation-delay: 160ms; }
.card-delay-3 { animation-delay: 240ms; }
.card-delay-4 { animation-delay: 320ms; }
.card-delay-5 { animation-delay: 400ms; }
.card-delay-6 { animation-delay: 480ms; }
.card-delay-7 { animation-delay: 560ms; }
.card-delay-8 { animation-delay: 640ms; }
.card-delay-9 { animation-delay: 720ms; }

/* --- Loading spinner --- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-card-hover);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 360px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Waste Cards --- */
.waste-card {
    position: relative;
    border-radius: var(--radius-xl);
    padding: 18px 16px;
    border: 1.5px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.waste-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.waste-card-mixed {
    background: var(--waste-mixed-bg);
    border-color: var(--waste-mixed-border);
}
.waste-card-mixed::before { background: var(--waste-mixed); }

.waste-card-bio {
    background: var(--waste-bio-bg);
    border-color: var(--waste-bio-border);
}
.waste-card-bio::before { background: var(--waste-bio); }

.waste-card-paper {
    background: var(--waste-paper-bg);
    border-color: var(--waste-paper-border);
}
.waste-card-paper::before { background: var(--waste-paper); }

.waste-card-plastic {
    background: var(--waste-plastic-bg);
    border-color: var(--waste-plastic-border);
}
.waste-card-plastic::before { background: var(--waste-plastic); }

/* --- Urgency Levels --- */
@keyframes urgencyPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.urgency-high {
    border-color: rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.15), inset 0 0 20px rgba(239, 68, 68, 0.05);
    animation: fadeSlideIn 0.35s ease-out both, urgencyPulse 2.5s ease-in-out infinite;
    transform: scale(1.02);
}

.urgency-medium {
    border-color: rgba(249, 115, 22, 0.5) !important;
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.1);
}

.urgency-low {
    opacity: 0.75;
}

.urgency-none {
    opacity: 0.45;
}

/* --- Urgency Badges --- */
.urgency-badge {
    display: inline-block;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    line-height: 1.4;
}

.urgency-badge-high {
    background: var(--accent-red);
    color: #fff;
}

.urgency-badge-medium {
    background: var(--accent-orange);
    color: #fff;
}

.urgency-badge-low {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-secondary);
}

/* --- Toggle switch --- */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--bg-card-hover);
    border-radius: var(--radius-pill);
    transition: background 0.2s ease;
}

.toggle-switch input:checked + .toggle-track {
    background: var(--accent-green);
}

.toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle-switch input:checked ~ .toggle-knob {
    transform: translateX(22px);
}

/* --- Time pill selectors --- */
.time-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border: 1px solid transparent;
    user-select: none;
}

.time-pill:hover {
    background: rgba(100, 116, 139, 0.3);
    color: var(--text-primary);
}

.time-pill.active {
    background: var(--accent-green);
    color: #fff;
    border-color: var(--accent-green);
}

/* --- Navigation tabs --- */
.nav-tab {
    position: relative;
    padding: 12px 0;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
    background: none;
    border: none;
    flex: 1;
    text-align: center;
}

.nav-tab:hover {
    color: var(--text-secondary);
}

.nav-tab.active {
    color: var(--text-primary);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15%;
    right: 15%;
    height: 3px;
    background: var(--accent-green);
    border-radius: 3px 3px 0 0;
}

/* --- Warning banner (morning) --- */
.morning-warning {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.78rem;
    color: var(--accent-yellow-warning);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- iOS banner --- */
.ios-banner {
    background: var(--bg-card);
    border-top: 1px solid var(--bg-card-hover);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* --- Button primary --- */
.btn-primary {
    background: var(--accent-green);
    color: #fff;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background: var(--accent-green-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Radio buttons (frequency / notification type) --- */
.radio-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 2px solid transparent;
}

.radio-pill:hover {
    background: var(--bg-card-hover);
}

.radio-pill.selected {
    background: rgba(22, 163, 74, 0.12);
    border-color: var(--accent-green);
    color: var(--text-primary);
}

.radio-pill input[type="radio"] {
    display: none;
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

/* --- Pulse animation for subscribe button --- */
@keyframes subtlePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
}

.btn-pulse {
    animation: subtlePulse 2s ease-in-out infinite;
}

/* --- Save message (success/error) --- */
.save-message {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: rgba(22, 163, 74, 0.15);
    color: #4ade80;
    border: 1px solid rgba(22, 163, 74, 0.3);
    text-align: center;
}

.save-message-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

/* --- View transition --- */
.view-enter {
    animation: fadeSlideIn 0.25s ease-out both;
}

/* --- Municipal branding stripe at top --- */
.brand-stripe {
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--waste-mixed) 0%,
        var(--waste-mixed) 25%,
        var(--waste-bio) 25%,
        var(--waste-bio) 50%,
        var(--waste-paper) 50%,
        var(--waste-paper) 75%,
        var(--waste-plastic) 75%,
        var(--waste-plastic) 100%
    );
}

/* --- Onboarding --- */
@keyframes onboardingFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.onboarding-container {
    width: 100%;
    max-width: 380px;
    animation: onboardingFadeIn 0.4s ease-out;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-card-hover);
    transition: all 0.3s ease;
}

.onboarding-dot.active {
    width: 24px;
    border-radius: var(--radius-pill);
    background: var(--accent-green);
}

.onboarding-dot.done {
    background: rgba(22, 163, 74, 0.4);
}

/* --- Utility: hide scrollbar --- */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
