/* Reset & Variables */
:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary: #3b82f6;
    --accent: #60a5fa;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding-bottom: 60px;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.install-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.install-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Hamburger Menu Button */
.hamburger {
    position: fixed;
    top: 76px;
    right: 1rem;
    z-index: 101;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.hamburger:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.hamburger span {
    display: block;
    width: 22px;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

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

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

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

/* Navigation Tabs */
.tabs {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    z-index: 99;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    overflow-y: auto;
    transition: right 0.3s ease;
}

.tabs.open {
    right: 0;
}

.menu-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1.5rem 1rem;
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.menu-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.tab {
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    color: var(--text);
    transition: var(--transition);
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
}

.tab-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.tab-label {
    font-weight: 600;
    font-size: 1rem;
}

.tab:hover {
    background: var(--bg);
    color: var(--primary);
}

.tab.active {
    background: var(--primary);
    color: white;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* Weather Widget */
.weather-widget {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.weather-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.weather-item .icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.weather-item .temp {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.weather-item .label {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Snow Info */
.snow-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.snow-stat {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.snow-stat .label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.snow-stat .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Webcams */
.webcam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.webcam-item {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
}

.webcam-item h3 {
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    font-size: 0.875rem;
}

.webcam-item img {
    width: 100%;
    height: auto;
    display: block;
}

.webcam-item small {
    display: block;
    padding: 0.5rem;
    color: var(--text-light);
    font-size: 0.75rem;
}

/* Traffic */
.traffic-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.traffic-route {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.route-name {
    font-weight: 600;
}

.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-ok {
    background: #d1fae5;
    color: #065f46;
}

.status-warning {
    background: #fed7aa;
    color: #92400e;
}

.status-danger {
    background: #fecaca;
    color: #991b1b;
}

.alert-box {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.info-item {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    transition: var(--transition);
}

.info-item:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-4px);
}

.info-item .icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.info-item h3 {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: inherit;
}

.info-item p {
    font-size: 1.25rem;
    font-weight: 700;
}

.info-item .price {
    color: var(--success);
    font-size: 1.5rem;
}

/* Buttons */
.btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-block;
    text-decoration: none;
}

.btn:hover {
    background: var(--border);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* Map */
.map-container {
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

.poi-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.poi-list li {
    padding: 0.5rem;
    background: var(--bg);
    border-radius: var(--radius);
}

/* Journal */
.journal-entries {
    margin-top: 1.5rem;
}

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 3rem 1rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.journal-entry {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
}

.journal-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.journal-entry-title {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
}

.journal-entry-date {
    color: var(--text-light);
    font-size: 0.875rem;
}

.journal-entry-notes {
    color: var(--text);
    margin-bottom: 0.75rem;
    line-height: 1.8;
}

.journal-entry-expense {
    display: inline-block;
    background: #d1fae5;
    color: #065f46;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
}

.journal-entry-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close:hover {
    background: var(--bg);
    color: var(--danger);
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-content input,
.modal-content textarea {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-content textarea {
    min-height: 100px;
    resize: vertical;
}

/* Settings */
.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.settings-section > p {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.checkbox-label:hover {
    background: var(--border);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== SNOW CONDITIONS ==================== */

/* Section header with badge */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.live-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    letter-spacing: 0.5px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.05); }
}

/* Status banner */
.snow-status-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: blink 2s ease-in-out infinite;
}

.status-indicator.status-excellent {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.status-indicator.status-good {
    background: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.status-indicator.status-ok {
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

.status-indicator.status-poor {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.status-text {
    flex: 1;
}

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

.status-text small {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Snow depths grid */
.snow-depths {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.depth-item {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 1.25rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.depth-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.depth-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.depth-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.depth-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.depth-alt {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Operations (pistes & remontées) */
.snow-operations {
    margin-bottom: 1.5rem;
}

.operation-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.operation-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.operation-details {
    flex: 1;
}

.operation-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.operation-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.operation-progress {
    height: 100%;
    border-radius: 20px;
    transition: width 0.6s ease, background-color 0.3s ease;
}

.operation-progress.progress-excellent {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.operation-progress.progress-good {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

.operation-progress.progress-ok {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.operation-progress.progress-poor {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.operation-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
}

/* Conditions badges */
.snow-conditions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.condition-badge {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
    transition: var(--transition);
}

.condition-badge:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.badge-icon {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.badge-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.badge-value {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
}

/* Button link */
.btn-link {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    width: 100%;
    margin-top: 0.5rem;
}

.btn-link:hover {
    background: var(--primary);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.25rem;
    }

    .tabs {
        gap: 0.25rem;
        padding: 0.5rem;
    }

    .tab {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .card {
        padding: 1rem;
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .snow-depths {
        grid-template-columns: 1fr;
    }

    .snow-conditions {
        grid-template-columns: repeat(3, 1fr);
    }

    .depth-item {
        padding: 1rem;
    }

    .depth-value {
        font-size: 1.25rem;
    }
}

/* Dark mode support (future) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --surface: #1e293b;
        --text: #f1f5f9;
        --text-light: #94a3b8;
        --border: #334155;
    }
}

/* iOS Safe Area */
@supports (padding: max(0px)) {
    body {
        padding-bottom: max(60px, env(safe-area-inset-bottom));
    }
}
