/**
 * Home Control - Design System
 * PostHog-inspired dark theme with premium animations
 */

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

/* =============================================================================
   CSS RESET & VARIABLES
   ============================================================================= */

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

:root {
    /* Dark theme (default) */
    --bg-primary: #0D0F14;
    --bg-secondary: #151921;
    --bg-tertiary: #1D212A;
    --bg-elevated: #252A35;

    --text-primary: #F7F8F9;
    --text-secondary: #9BA1AC;
    --text-muted: #5E6573;

    --accent: #F54E00;
    --accent-light: #FF6B24;
    --accent-glow: rgba(245, 78, 0, 0.3);
    --accent-subtle: rgba(245, 78, 0, 0.1);

    --success: #30D158;
    --pause: #0A84FF;
    --pause-glow: rgba(10, 132, 255, 0.3);
    --pause-subtle: rgba(10, 132, 255, 0.1);
    --danger: #FF453A;

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --nav-height: 72px;

    /* EV Charging Colors */
    --charge-cheap: #22c55e;
    --charge-cheap-subtle: rgba(34, 197, 94, 0.15);
    --charge-burst: #f59e0b;
    --charge-burst-subtle: rgba(245, 158, 11, 0.15);
    --charge-expensive: #ef4444;
    --charge-expensive-subtle: rgba(239, 68, 68, 0.15);
    --charge-predicted: #3b82f6;
    --charge-predicted-subtle: rgba(59, 130, 246, 0.15);
}

html[data-theme="light"] {
    --bg-primary: #F8F9FA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F0F2F5;
    --bg-elevated: #FFFFFF;
    --text-primary: #1D1F27;
    --text-secondary: #5E6573;
    --text-muted: #9BA1AC;
    --border: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);

    /* EV Charging Colors (Light Theme) */
    --charge-cheap: #16a34a;
    --charge-cheap-subtle: rgba(22, 163, 74, 0.1);
    --charge-burst: #d97706;
    --charge-burst-subtle: rgba(217, 119, 6, 0.1);
    --charge-expensive: #dc2626;
    --charge-expensive-subtle: rgba(220, 38, 38, 0.1);
    --charge-predicted: #2563eb;
    --charge-predicted-subtle: rgba(37, 99, 235, 0.1);
}

/* =============================================================================
   BASE STYLES
   ============================================================================= */

body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}

#app {
    padding: 16px;
    padding-bottom: calc(var(--nav-height) + 32px);
    max-width: 480px;
    margin: 0 auto;
}

/* =============================================================================
   SHARED UTILITIES
   ============================================================================= */

.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }

.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    transition: all 0.2s ease;
}

.card:hover { border-color: var(--border-hover); }

.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =============================================================================
   PILLS & BADGES
   ============================================================================= */

.pill {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pill:hover { border-color: var(--accent); transform: scale(1.05); }
.pill:active { transform: scale(0.95); }

.pill.active {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.status-badge.status-inline {
    padding: 2px 8px;
    font-size: 10px;
    line-height: 1;
}

.status-badge.boost { background: var(--accent-subtle); color: var(--accent); }
.status-badge.pause { background: var(--pause-subtle); color: var(--pause); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon.danger:hover { background: var(--danger); border-color: var(--danger); color: white; }

.override-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    position: relative;
    overflow: hidden;
}

.override-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.override-btn:hover::before { opacity: 1; }

.override-btn.boost {
    background: linear-gradient(135deg, #FF6B24, #F54E00);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.override-btn.pause {
    background: linear-gradient(135deg, #3395FF, #0A84FF);
    box-shadow: 0 4px 20px var(--pause-glow);
}

.override-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.override-btn.pause:hover { box-shadow: 0 8px 32px var(--pause-glow); }
.override-btn:active { transform: scale(0.95); }
.override-btn svg { width: 16px; height: 16px; }

/* =============================================================================
   APP HEADER
   ============================================================================= */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    animation: fadeDown 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-toggle {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.theme-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn:hover { color: var(--text-secondary); }
.theme-btn.active { background: var(--bg-elevated); color: var(--accent); }

/* =============================================================================
   HOUSE OVERRIDE SECTION
   ============================================================================= */

.house-override {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    animation: fadeDown 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.1s backwards;
}

.house-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.house-override-details {
    margin-top: 12px;
    display: none;
}

.house-override-details.visible { display: block; }

.override-time-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    gap: 8px;
}

.override-time-row.boost-active { background: var(--accent-subtle); border: 1px solid rgba(245, 78, 0, 0.2); }
.override-time-row.pause-active { background: var(--pause-subtle); border: 1px solid rgba(10, 132, 255, 0.2); }

.override-type-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
}

.boost-active .override-type-label { color: var(--accent); }
.pause-active .override-type-label { color: var(--pause); }

.override-time-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.override-time-btn:hover { border-color: var(--accent); }

.override-cancel-btn {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.override-cancel-btn:hover { border-color: var(--danger); color: var(--danger); }

.override-room-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pause-active .pill.active { background: var(--pause-subtle); border-color: var(--pause); color: var(--pause); }

/* =============================================================================
   SUB-TABS (PROMINENT TOGGLE)
   ============================================================================= */

.sub-tabs {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    position: relative;
    border: 1px solid var(--border);
}

.sub-tab {
    flex: 1;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.sub-tab:hover { color: var(--text-secondary); }

.sub-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
    transform: scale(1.02);
}

.sub-tab.active:active { transform: scale(0.98); }

.sub-content {
    display: none;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =============================================================================
   FLOOR GROUPS
   ============================================================================= */

.floor-group { margin-bottom: 12px; }

.floor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floor-header:hover {
    border-color: var(--border-hover);
    background: var(--bg-elevated);
}

.floor-chevron {
    color: var(--text-muted);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.floor-group.collapsed .floor-chevron { transform: rotate(-90deg); }

.floor-rooms {
    display: grid;
    gap: 10px;
    margin-top: 10px;
    max-height: 1000px;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.floor-group.collapsed .floor-rooms {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    margin-top: 0;
    pointer-events: none;
}

/* =============================================================================
   ROOM CARDS
   ============================================================================= */

.room-card {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.room-card:nth-child(1) { animation-delay: 0.05s; }
.room-card:nth-child(2) { animation-delay: 0.1s; }
.room-card:nth-child(3) { animation-delay: 0.15s; }
.room-card:nth-child(4) { animation-delay: 0.2s; }

.room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3);
    border-color: var(--accent);
}

.room-card:active { transform: scale(0.98); }
.room-card.heating { border-color: rgba(245, 78, 0, 0.3); }

.room-card.heating .room-temp-current {
    color: var(--accent);
    text-shadow: 0 0 30px var(--accent-glow);
    animation: tempPulse 2s ease-in-out infinite;
}

.room-name { font-size: 14px; font-weight: 700; }

.room-status {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.room-status.heating { color: var(--accent); }

.room-temps { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 6px; }

.room-temp-current {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    transition: all 0.3s ease;
}

.room-temp-target { font-size: 13px; font-weight: 600; color: var(--text-muted); }

.room-bottom { display: flex; justify-content: space-between; align-items: center; }
.room-next { font-size: 11px; font-weight: 500; color: var(--text-muted); }

.room-override-badge {
    display: none;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.room-override-badge.visible { display: inline-flex; }
.room-override-badge.boost { background: var(--accent-subtle); color: var(--accent); }
.room-override-badge.pause { background: var(--pause-subtle); color: var(--pause); }

.room-sparkline { width: 60px; height: 20px; }
.room-sparkline svg { width: 100%; height: 100%; }

.sparkline-path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.6;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawLine 1.5s ease-out forwards;
}

.room-card:hover .sparkline-path { opacity: 1; }

/* =============================================================================
   SCHEDULE CARDS
   ============================================================================= */

.schedule-card {
    margin-bottom: 12px;
    padding: 16px;
    animation: cardReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.schedule-card:nth-child(1) { animation-delay: 0.05s; }
.schedule-card:nth-child(2) { animation-delay: 0.1s; }
.schedule-card:nth-child(3) { animation-delay: 0.15s; }

.schedule-card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.schedule-name-wrapper { flex: 1; min-width: 0; }

.schedule-name {
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.schedule-name:hover { background: var(--bg-tertiary); }
.schedule-name .edit-icon { opacity: 0; color: var(--text-muted); transition: opacity 0.2s ease; }
.schedule-name:hover .edit-icon { opacity: 1; }

.schedule-name-input {
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    color: var(--text-primary);
    width: 100%;
}

.schedule-actions { display: flex; align-items: center; gap: 8px; }

.schedule-toggle {
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease;
}

.schedule-toggle.active { background: var(--success); }

.schedule-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.schedule-toggle.active::after { transform: translateX(20px); }

/* Collapse toggle */
.collapse-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    margin-right: 4px;
}
.collapse-toggle:hover { color: var(--text-primary); }
.collapse-toggle svg { transition: transform 0.2s ease; }
.schedule-card:not(.collapsed) .collapse-toggle svg { transform: rotate(90deg); }

/* Schedule body - hides when collapsed */
.schedule-body {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}
.schedule-card.collapsed .schedule-body {
    max-height: 0;
    opacity: 0;
    margin: 0;
}
.schedule-card.collapsed {
    padding-bottom: 12px;
}
.schedule-card.collapsed .schedule-header {
    margin-bottom: 0;
}

/* Drag handle */
.drag-handle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--text-muted);
    flex-shrink: 0;
    touch-action: none; /* Prevent scroll on touch drag */
}
.drag-handle:hover { color: var(--text-primary); }
.drag-handle:active { cursor: grabbing; }

/* Drag and drop */
.schedule-card.dragging {
    opacity: 0.5;
}
.schedule-card.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.schedule-days, .schedule-rooms { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.schedule-rooms { gap: 6px; }

.day-pill {
    width: 36px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.day-pill:hover { border-color: var(--accent); transform: translateY(-2px); }
.day-pill:active { transform: scale(0.9); }

.day-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* =============================================================================
   TIME SLOTS
   ============================================================================= */

.time-slots { margin-top: 12px; }

.time-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.time-slot-times { display: flex; align-items: center; gap: 8px; }

.time-input {
    width: 120px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color-scheme: dark;
}

html[data-theme="light"] .time-input { color-scheme: light; }
.time-input:focus { outline: none; border-color: var(--accent); }

.time-slot-arrow { color: var(--text-muted); font-size: 14px; font-weight: 600; }

.temp-range {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.temp-range-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.temp-range-value:hover { background: var(--accent-subtle); }

.temp-range-divider { width: 10px; height: 2px; background: var(--text-muted); border-radius: 1px; }

.time-slot-delete { width: 32px; height: 32px; margin-left: auto; }

/* Time slot validation error */
.time-slot.has-error { border: 1px solid var(--danger); }
.slot-error {
    width: 100%;
    font-size: 11px;
    color: var(--danger);
    margin-top: 8px;
    line-height: 1.4;
}

.add-slot-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.add-slot-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.add-schedule-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.add-schedule-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.add-schedule-btn:active { transform: scale(0.98); }

/* =============================================================================
   BOTTOM NAVIGATION
   ============================================================================= */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px 24px;
    padding-bottom: max(env(safe-area-inset-bottom, 8px), 8px);
    backdrop-filter: blur(20px);
    z-index: 1000;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 32px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    position: relative;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 24px;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
    transition: transform 0.2s ease;
}

.nav-btn:hover { color: var(--text-secondary); }
.nav-btn.active { color: var(--accent); }
.nav-btn.active::before { transform: translateX(-50%) scaleX(1); }

.nav-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Syncing indicator on nav buttons */
.nav-btn.syncing svg {
    animation: navSyncPulse 1.2s ease-in-out infinite;
}

.nav-btn.syncing::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    animation: navSyncDot 1.2s ease-in-out infinite;
}

@keyframes navSyncPulse {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 0 transparent); }
    50% { opacity: 0.5; filter: drop-shadow(0 0 6px var(--accent)); }
}

@keyframes navSyncDot {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.4; transform: translateX(-50%) scale(0.6); }
}

/* =============================================================================
   DRAWER
   ============================================================================= */

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

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

.drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: var(--bg-secondary);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 101;
    overflow: hidden;
    box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
}

.drawer-overlay.active .drawer { transform: translateY(0); }

.drawer-handle {
    width: 36px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 12px auto;
    opacity: 0.4;
}

.drawer-content {
    padding: 0 20px calc(var(--nav-height) + 32px);
    max-height: calc(85vh - 28px);
    overflow-y: auto;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.drawer-title { font-size: 22px; font-weight: 800; }

.drawer-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
}

.drawer-section { margin-bottom: 20px; }
.drawer-section-title { margin-bottom: 12px; }

.drawer-temp-display {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 20px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
}

.drawer-temp-main, .drawer-status-box { text-align: center; }

.drawer-temp-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.drawer-temp-value { font-size: 42px; font-weight: 800; letter-spacing: -0.02em; }
.drawer-temp-value.heating { color: var(--accent); text-shadow: 0 0 30px var(--accent-glow); }

.drawer-status-text { font-size: 16px; font-weight: 700; }
.drawer-status-text.heating { color: var(--accent); }
.drawer-status-text.off { color: var(--text-muted); }

.drawer-override-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.drawer-override-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    color: white;
}

.drawer-override-btn.boost { background: linear-gradient(135deg, #FF6B24, #F54E00); }
.drawer-override-btn.pause { background: linear-gradient(135deg, #3395FF, #0A84FF); }
.drawer-override-btn:hover { transform: translateY(-2px); }

.drawer-override-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
}

.drawer-override-text { text-align: left; }
.drawer-override-label { font-size: 14px; font-weight: 700; }
.drawer-override-sub { font-size: 11px; opacity: 0.8; }

.room-override-active {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: none;
}

.room-override-active.visible { display: block; }
.room-override-active.boost { background: var(--accent-subtle); border: 1px solid rgba(245, 78, 0, 0.2); }
.room-override-active.pause { background: var(--pause-subtle); border: 1px solid rgba(10, 132, 255, 0.2); }

.room-override-info { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.room-override-type { font-size: 13px; font-weight: 700; }
.room-override-active.boost .room-override-type { color: var(--accent); }
.room-override-active.pause .room-override-type { color: var(--pause); }

/* =============================================================================
   HISTORY CHART
   ============================================================================= */

.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.history-range-btns { display: flex; gap: 4px; }

.history-range-btn {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.history-range-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

.history-chart-container {
    position: relative;
    height: 120px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px 0;
}

.history-chart { width: 100%; height: 100%; display: block; }

.history-tooltip {
    position: absolute;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    white-space: nowrap;
}

.history-tooltip.visible { opacity: 1; }
.history-tooltip-time { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.history-tooltip-temp { color: var(--accent); font-weight: 700; }

.chart-hover-line { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 4 2; opacity: 0; }
.chart-hover-dot { fill: var(--accent); opacity: 0; }
.chart-y-label { font-size: 9px; fill: var(--text-muted); font-family: inherit; }

.active-schedule-link {
    display: block;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.active-schedule-link:hover { background: var(--bg-elevated); transform: translateX(4px); }
.active-schedule-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.active-schedule-time { font-size: 11px; color: var(--text-muted); }
.active-schedule-arrow { float: right; color: var(--text-muted); margin-top: -24px; }

/* =============================================================================
   USERS TAB
   ============================================================================= */

.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.user-item:hover { border-color: var(--border-hover); }

.user-info { display: flex; flex-direction: column; gap: 2px; }
.user-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.user-id { font-size: 11px; color: var(--text-muted); font-family: monospace; }

.user-item .remove-btn {
    padding: 6px 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-item .remove-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.add-user-form {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    animation: slideUp 0.3s ease-out;
}

.form-group { margin-bottom: 12px; }

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

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

.add-user-btn, .save-user-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.add-user-btn:hover, .save-user-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.add-user-btn:active, .save-user-btn:active { transform: scale(0.98); }

.no-access, .no-users, .loading-text, .error-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px;
}

.error-text { color: var(--danger); }

/* =============================================================================
   LOADING & ERROR SCREENS
   ============================================================================= */

.screen {
    display: flex;
    flex-direction: column;
    min-height: 60vh;
}

#loading {
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#loading p {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

#error {
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
    padding: 32px;
}

.error-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--danger), #FF6B6B);
    color: white;
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(255, 69, 58, 0.3);
}

#error-message {
    color: var(--text-secondary);
    font-size: 15px;
    max-width: 280px;
}

#error button {
    margin-top: 8px;
    padding: 12px 32px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#error button:hover { background: var(--accent-light); transform: translateY(-1px); }
#error button:active { transform: translateY(0); }

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

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

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

@keyframes cardReveal {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tempPulse {
    0%, 100% { text-shadow: 0 0 20px var(--accent-glow); }
    50% { text-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--accent-glow); }
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

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

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

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
   RESPONSIVE & UTILITIES
   ============================================================================= */

@media (max-width: 360px) {
    #app { padding: 12px; padding-bottom: calc(var(--nav-height) + 24px); }
    .room-temp-current { font-size: 24px; }
    .drawer-temp-value { font-size: 36px; }
    .sub-tab { padding: 12px 16px; font-size: 13px; }
}

html { scroll-behavior: smooth; }
::selection { background: var(--accent); color: white; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* =============================================================================
   TOAST NOTIFICATIONS
   ============================================================================= */

.toast-notification {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100% - 32px);
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.toast-notification.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-error {
    background: linear-gradient(135deg, #FF6B6B, var(--danger));
    color: white;
}

.toast-success {
    background: linear-gradient(135deg, #4CD964, var(--success));
    color: white;
}

.toast-info {
    background: linear-gradient(135deg, #5AC8FA, var(--pause));
    color: white;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =============================================================================
   EV CHARGING - CAR STATUS CARDS
   ============================================================================= */

.car-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.car-card.plugged {
    border-left: 3px solid var(--charge-cheap);
}

.car-card.unplugged {
    opacity: 0.7;
}

.car-card.unplugged.recommended {
    opacity: 1;
    border-left: 3px solid var(--charge-predicted);
}

.car-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.car-name {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plug-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.plug-indicator.plugged {
    background: var(--charge-cheap);
}

.plug-indicator.charging {
    background: var(--charge-cheap);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.control-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn.start {
    background: var(--charge-cheap);
    color: white;
}

.control-btn.stop {
    background: var(--charge-expensive);
    color: white;
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================================================================
   EV CHARGING - BATTERY BAR
   ============================================================================= */

.battery-bar-container {
    position: relative;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.battery-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--charge-cheap), #4ade80);
    border-radius: 12px;
    transition: width 0.5s ease;
}

.battery-target-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
}

.battery-percent {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* =============================================================================
   EV CHARGING - TRIP INFO & STATUS BADGES
   ============================================================================= */

.trip-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.trip-countdown {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Schedule info row */
.schedule-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.schedule-info.active {
    background: var(--charge-cheap-subtle);
    margin: 8px -12px -12px -12px;
    padding: 8px 12px;
    border-radius: 0 0 12px 12px;
    border-top: 1px solid var(--charge-cheap);
}

.schedule-text {
    color: var(--text-secondary);
    font-size: 13px;
}

.schedule-info.active .schedule-text {
    color: var(--charge-cheap);
    font-weight: 500;
}

.schedule-type {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.schedule-type.charge-cheap {
    background: var(--charge-cheap-subtle);
    color: var(--charge-cheap);
}

.schedule-type.charge-burst {
    background: var(--charge-burst-subtle);
    color: var(--charge-burst);
}

.schedule-type.charge-expensive {
    background: var(--charge-expensive-subtle);
    color: var(--charge-expensive);
}

.schedule-type.charge-predicted {
    background: var(--charge-predicted-subtle);
    color: var(--charge-predicted);
}

/* Charge-specific status badges (extends base .status-badge) */
.status-ready {
    background: var(--charge-cheap-subtle);
    color: var(--charge-cheap);
}

.status-on-track {
    background: var(--charge-cheap-subtle);
    color: var(--charge-cheap);
}

.status-needs-bursts {
    background: var(--charge-burst-subtle);
    color: var(--charge-burst);
}

.status-shortfall {
    background: var(--charge-expensive-subtle);
    color: var(--charge-expensive);
}

.status-error {
    background: var(--charge-expensive-subtle);
    color: var(--charge-expensive);
}

.status-badge.status-clickable {
    cursor: pointer;
    text-decoration: underline;
}

.status-away,
.status-paused,
.status-disabled {
    background: var(--secondary-bg);
    color: var(--text-secondary);
}

.status-manual {
    background: var(--charge-burst-subtle);
    color: var(--charge-burst);
}

.status-force {
    background: var(--charge-cheap-subtle);
    color: var(--charge-cheap);
}

.status-simple {
    background: var(--charge-cheap-subtle);
    color: var(--charge-cheap);
}

/* =============================================================================
   EV CHARGING - PLUG INSTRUCTION BANNER
   ============================================================================= */

.plug-instruction {
    background: var(--charge-cheap-subtle);
    border: 1px solid var(--charge-cheap);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.plug-instruction-icon {
    color: var(--charge-cheap);
    flex-shrink: 0;
}

.plug-instruction-text {
    color: var(--text-primary);
    font-size: 14px;
}

.plug-instruction-text strong {
    font-weight: 600;
    color: var(--charge-cheap);
}

.plug-instruction-inline {
    margin-bottom: 8px;
    padding: 6px 0;
}

.plug-instruction-inline-text {
    color: var(--charge-predicted);
    font-size: 12px;
    font-weight: 500;
}

/* =============================================================================
   EV CHARGING - TIMELINE & SUMMARY
   ============================================================================= */

.timeline-summary {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.timeline-summary:hover {
    background: var(--bg-tertiary);
}

.timeline-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.stat-box {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-box.cheap .stat-value { color: var(--charge-cheap); }
.stat-box.burst .stat-value { color: var(--charge-burst); }
.stat-box.expensive .stat-value { color: var(--charge-expensive); }

.usage-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: var(--charge-cheap);
    transition: width 0.3s ease;
}

.day-track {
    position: relative;
    height: 32px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.charge-block {
    position: absolute;
    top: 4px;
    bottom: 4px;
    border-radius: 4px;
}

/* Car charging line colors based on budget status:
 * - within-budget: car pays 7p/kWh (green)
 * - over-budget: car pays 29.2p/kWh (red) - only for trip targets
 */
.charge-block.within-budget { background: var(--charge-cheap); }
.charge-block.over-budget { background: var(--charge-expensive); }
.charge-block.predicted { background: var(--charge-predicted); opacity: 0.7; }

/* Planned (future) blocks: semi-transparent to distinguish from actual */
.charge-block.planned-block {
    opacity: 0.4;
}
.charge-block.predicted.planned-block {
    opacity: 0.35;
}

/* Now marker - vertical line showing current time on today's track */
.now-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--text-primary);
    z-index: 5;
    opacity: 0.7;
}
.now-marker::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -2px;
    width: 6px;
    height: 6px;
    background: var(--text-primary);
    border-radius: 50%;
}

/* Home rate background - shows cheap window vs expensive periods */
.home-rate-bg {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: 0.3;
}
.home-rate-bg.cheap { background: var(--charge-cheap); }
.home-rate-bg.expensive { background: var(--charge-expensive); }

.trip-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
}

.trip-marker::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -3px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
}

/* =============================================================================
   EV CHARGING - MODAL
   ============================================================================= */

.charge-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.charge-modal {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.charge-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.charge-modal-title {
    font-size: 18px;
    font-weight: 600;
}

.charge-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.charge-modal-content {
    padding: 16px;
}

.charge-modal-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* =============================================================================
   EV CHARGING - FORM STYLES
   ============================================================================= */

.charge-form-group {
    margin-bottom: 16px;
}

.charge-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.charge-form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
}

.charge-form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.charge-day-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.charge-day-pill {
    padding: 8px 12px;
    border-radius: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.charge-day-pill.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* =============================================================================
   EV CHARGING - SETTINGS PANEL
   ============================================================================= */

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 100%;
    background: var(--bg-primary);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.settings-panel.open {
    transform: translateX(0);
}

.settings-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.settings-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.settings-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* =============================================================================
   EV CHARGING - SUB-TAB NAVIGATION
   ============================================================================= */

.charge-subtabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.charge-subtab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.charge-subtab.active {
    background: var(--accent);
    color: white;
}

/* =============================================================================
   EV CHARGING - MODE TOGGLE
   ============================================================================= */

.charge-mode-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.charge-mode-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.charge-mode-btn:hover {
    background: var(--bg-tertiary);
}

.charge-mode-btn.active {
    background: var(--accent);
    color: white;
}

.charge-mode-btn.active.mode-disable {
    background: var(--charge-expensive);
}

.charge-mode-btn.active.mode-force {
    background: var(--charge-burst);
}

.charge-mode-btn.active.mode-simple {
    background: var(--charge-cheap);
}

/* .charge-mode-sublabel removed — force mode no longer shows car name */

/* =============================================================================
   EV CHARGING - MANUAL SCHEDULE
   ============================================================================= */

.manual-schedule {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.manual-car {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--secondary-bg);
}

.manual-car-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.manual-car-title {
    font-weight: 600;
    font-size: 14px;
}

.manual-save {
    border: none;
    background: var(--accent);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}

.manual-day-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.manual-day-row {
    display: grid;
    grid-template-columns: 40px 1fr 30px 1fr;
    gap: 8px;
    align-items: center;
}

.manual-day-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.manual-time {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
}

.manual-time-sep {
    font-size: 12px;
    text-align: center;
    color: var(--text-secondary);
}

.manual-help {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* =============================================================================
   EV CHARGING - TRIP LIST
   ============================================================================= */

.trip-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trip-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.trip-item:hover {
    background: var(--bg-tertiary);
}

.trip-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: var(--text-secondary);
}

.trip-item-details {
    flex: 1;
}

.trip-item-car {
    font-weight: 500;
    font-size: 15px;
}

.trip-item-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.trip-item-target {
    font-weight: 600;
    color: var(--accent);
}

.trip-type-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    margin-left: 8px;
}
