/* Mobile-first responsive design for Powerwall Dashboard */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
}

.connection-status {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.connection-status.connected {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

@media (min-width: 768px) {
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .status-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Schedule timeline card takes full width */
    .schedule-timeline-card {
        grid-column: 1 / -1;
    }

    /* Weather card spans full width when it would be alone */
    .weather-card {
        grid-column: 1 / -1;
    }
}

/* Weather card spans full width on medium screens */
@media (min-width: 768px) and (max-width: 1023px) {
    .weather-card {
        grid-column: 1 / -1;
    }
}

/* Ensure all cards have consistent minimum heights */
.battery-card,
.battery-time-card,
.power-card,
.schedule-card,
.grid-status-card,
.wall-connector-card,
.sun-potential-card {
    min-height: 220px;
}

/* Other cards should have slightly smaller min-height */
.weather-card {
    min-height: 200px;
}

.battery-time-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.battery-time-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
}

/* Ensure battery card content is properly distributed */
.battery-card {
    justify-content: flex-start;
}

.battery-card .battery-level {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.battery-details {
    margin-top: auto;
}

/* Card Styles */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
}

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

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Battery Card */
.battery-card .battery-level {
    text-align: center;
    margin-bottom: 15px;
}

.battery-percentage {
    font-size: 2.5rem;
    font-weight: 700;
    color: #27ae60;
    line-height: 1;
}

.battery-bar {
    width: 100%;
    height: 40px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.battery-fill {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c 0%, #f39c12 30%, #27ae60 60%);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.battery-capacity {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 5px;
    font-weight: 500;
}

.battery-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 0.9rem;
}

.battery-details > div {
    text-align: center;
    padding: 8px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
}

.battery-details > div:nth-child(3) {
    grid-column: 1 / -1;
}

/* Power Card */
.power-card {
    justify-content: flex-start;
}

.power-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    flex: 1;
    align-content: center;
}

.power-item {
    text-align: center;
    padding: 15px 10px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 12px;
}

.power-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.power-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.power-label {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* Grid Status Card */
.grid-status-card {
    justify-content: flex-start;
}

.grid-status-info {
    text-align: center;
    margin-top: 0;
}

.grid-status-display {
    font-size: 1.4rem;
    font-weight: 600;
    padding: 15px 20px;
    border-radius: 10px;
    background: rgba(52, 152, 219, 0.1);
    border: 2px solid #3498db;
    transition: all 0.3s ease;
}

.grid-status-display.on-grid {
    background: rgba(39, 174, 96, 0.2);
    border-color: #27ae60;
    color: #27ae60;
}

.grid-status-display.off-grid {
    background: rgba(231, 76, 60, 0.2);
    border-color: #e74c3c;
    color: #e74c3c;
    animation: pulse 2s infinite;
}

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

/* Battery Time Remaining Card */
.battery-time-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    /* Remove margin override that was causing size differences */
    margin: 0;
    /* Keep normal card flex behavior since it has a header */
    justify-content: flex-start;
}

.battery-time-info {
    text-align: center;
    /* Remove duplicate padding since card already has padding */
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.battery-time-display {
    background: rgba(255, 165, 0, 0.1);
    border: 2px solid #ff9500;
    border-radius: 10px;
    padding: 20px;
    color: #e67e22;
    transition: all 0.3s ease;
}

.time-remaining-main {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

.time-label {
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.9;
}

.time-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #d35400;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.time-actual {
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
    opacity: 0.8;
    flex-direction: column;
    gap: 5px;
    text-align: center;
}

.actual-time-label {
    font-size: 1rem;
}

.actual-time-value {
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    color: #d35400;
}

/* Responsive adjustments for battery time card */
@media (max-width: 600px) {
    .time-remaining-main, .time-actual {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }

    .time-value {
        font-size: 1.6rem;
    }

    .time-label, .actual-time-label {
        font-size: 1rem;
    }
}

/* Sun Potential Card */
.sun-potential-card {
    justify-content: flex-start;
}

.sun-potential-info {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
}

.daylight-times {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.sunrise-time, .sunset-time {
    display: flex;
    align-items: center;
    gap: 5px;
}

.daylight-duration {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f39c12;
    padding: 8px 15px;
    background: rgba(243, 156, 18, 0.1);
    border-radius: 8px;
}

/* Tesla Wall Connector Card */
.wall-connector-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Keep normal card flex behavior since it has a header */
    justify-content: flex-start;
}


.wall-connector-info {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.wall-connector-status {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.wall-connector-status .status-display {
    font-size: 1.3rem;
    font-weight: 600;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 0;
    transition: all 0.3s ease;
}

.wall-connector-status .status-display.available {
    background: rgba(52, 152, 219, 0.1);
    border: 2px solid #3498db;
    color: #3498db;
}

.wall-connector-status .status-display.connected {
    background: rgba(243, 156, 18, 0.1);
    border: 2px solid #f39c12;
    color: #f39c12;
}

.wall-connector-status .status-display.charging {
    background: rgba(39, 174, 96, 0.1);
    border: 2px solid #27ae60;
    color: #27ae60;
    animation: pulse-charging 2s infinite;
}

.wall-connector-status .status-display.faulted {
    background: rgba(231, 76, 60, 0.1);
    border: 2px solid #e74c3c;
    color: #e74c3c;
    animation: pulse 1s infinite;
}

.wall-connector-status .power-display {
    font-size: 2rem;
    font-weight: 700;
    color: #27ae60;
    margin-bottom: 10px;
}

.wall-connector-status .vehicle-charge-display {
    font-size: 1.4rem;
    font-weight: 600;
    color: #3498db;
    margin-bottom: 5px;
}

.wall-connector-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.wall-connector-details .detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
}

.wall-connector-details .detail-label {
    font-weight: 600;
    color: #34495e;
}

.wall-connector-details .detail-value {
    font-weight: 500;
    color: #2c3e50;
}

.wall-connector-details .detail-value.ready {
    color: #95a5a6;
}

.wall-connector-details .automation-status {
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid #f39c12;
}

.wall-connector-details .automation-status .detail-value {
    color: #f39c12;
    font-weight: 600;
}

@keyframes pulse-charging {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

/* Schedule Card */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.schedule-item.active-mode {
    background: rgba(39, 174, 96, 0.2);
    border: 2px solid #27ae60;
    box-shadow: 0 2px 10px rgba(39, 174, 96, 0.3);
    transform: scale(1.02);
}

.schedule-item.active-mode .schedule-name,
.schedule-item.active-mode .schedule-time {
    color: #27ae60;
    font-weight: 700;
}

.schedule-time {
    font-weight: 700;
    color: inherit; /* Use same color as parent/schedule-name */
    width: 60px;
    text-align: left;
    flex-shrink: 0;
}

.schedule-name {
    flex: 1;
    text-align: left;
    font-weight: 500;
    margin-left: 15px;
}


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

/* ========================================
   NEW TIMELINE SCHEDULE CARD STYLES
   ======================================== */

/* Schedule Timeline Card - Full Width */
.schedule-timeline-card {
    padding: 25px;
    min-height: 180px;
}

.schedule-timeline-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    position: relative;
}

.grid-charge-time {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(231, 76, 60, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #e74c3c;
    white-space: nowrap;
    transition: left 0.3s ease, transform 0.3s ease;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: fit-content;
}

.current-time {
    background: rgba(52, 152, 219, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #3498db;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.time-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Timeline Container */
.timeline-container {
    position: relative;
    height: 160px;
}

.timeline-track {
    position: relative;
    height: 120px;
    pointer-events: none;
    background: linear-gradient(to right,
        rgba(52, 152, 219, 0.1) 0%,
        rgba(52, 152, 219, 0.15) 25%,
        rgba(231, 76, 60, 0.15) 66.6%,
        rgba(231, 76, 60, 0.2) 87.4%,
        rgba(52, 152, 219, 0.1) 100%
    );
    border-radius: 30px;
    border: 2px solid rgba(52, 152, 219, 0.3);
    overflow: visible;
}

/* Hour Markers */
.hour-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}


/* Current Time Indicator */
.current-time-indicator {
    position: absolute;
    top: -10px;
    height: 140px;
    width: 3px;
    pointer-events: none;
    z-index: 10;
}

.time-line {
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, #e74c3c, #c0392b);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
    animation: pulse-line 2s infinite;
}

.time-dot {
    position: absolute;
    top: 50%; /* Default position - will be updated by JavaScript */
    left: 50%;
    width: 20px; /* Increased size for better hover area */
    height: 20px; /* Increased size for better hover area */
    background: #e74c3c;
    border: 3px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
    animation: pulse-dot 2s infinite;
    transition: top 0.5s ease; /* Smooth movement as battery percentage changes */
    cursor: pointer; /* Show it's interactive */
    z-index: 1000 !important; /* Much higher z-index */
    pointer-events: auto !important; /* Ensure it can receive mouse events */
}

/* Battery tooltip using exact same pattern as working schedule tooltips */
.battery-label {
    position: absolute;
    top: -55px; /* Same as working tooltips */
    left: 50%;
    transform: translateX(-50%) translateY(-10px); /* Hidden state */
    background: white;
    border: 2px solid #3498db;
    color: #3498db;
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 50px;
    opacity: 0; /* Hidden by default */
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    text-align: center;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
}

/* Show battery tooltip on hover - exact same pattern as working tooltips */
.time-dot:hover .battery-label {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

@keyframes pulse-line {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes pulse-dot {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 0 0 6px rgba(231, 76, 60, 0.2);
    }
}

/* Schedule Points */
.schedule-points {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.schedule-point {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
    pointer-events: all;
}

.schedule-point:hover {
    transform: translateY(-50%) scale(1.1);
}

.point-marker {
    position: relative;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateX(-50%);
    transition: all 0.3s ease;
}

.point-label {
    position: absolute;
    top: -55px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 8px 12px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: 2px solid;
    text-align: center;
    min-width: 80px;
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.schedule-point:hover .point-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.point-time {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.point-name {
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Point Styling by Type */
.night-mode .point-marker {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: 3px solid white;
    color: white;
}

.night-mode .point-label {
    border-color: #3498db;
    color: #3498db;
}

.grid-charge .point-marker {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border: 3px solid white;
    color: white;
    animation: charge-pulse 2s infinite;
}

.grid-charge .point-label {
    border-color: #f39c12;
    color: #f39c12;
}

.peak-mode .point-marker {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 3px solid white;
    color: white;
}

.peak-mode .point-label {
    border-color: #e74c3c;
    color: #e74c3c;
}

/* Active state for current mode */
.schedule-point.active {
    z-index: 15;
}

.schedule-point.active .point-marker {
    animation: active-pulse 1.5s infinite;
    box-shadow: 0 0 0 8px rgba(39, 174, 96, 0.2);
}

.schedule-point.active .point-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    border-color: #27ae60;
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

@keyframes charge-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(243, 156, 18, 0.4);
    }
    50% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 8px rgba(243, 156, 18, 0.2);
    }
}

@keyframes active-pulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.1);
    }
}

/* Time Periods Background */
.time-periods {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.period {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.period-label {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.off-peak-period {
    background: rgba(52, 152, 219, 0.05);
}

.off-peak-period .period-label {
    color: #3498db;
}

.peak-period {
    background: rgba(231, 76, 60, 0.1);
}

.peak-period .period-label {
    color: #e74c3c;
}

/* Timeline Labels */
.timeline-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding: 0 10px;
}

.timeline-label {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* Mobile responsiveness for timeline */
@media (max-width: 768px) {
    .schedule-timeline-card {
        padding: 20px 15px;
        min-height: 160px;
    }

    .schedule-timeline-card .card-header {
        margin-bottom: 20px;
    }

    .current-time {
        font-size: 1rem;
        padding: 6px 12px;
        color: white !important;
        background: rgba(52, 152, 219, 0.8) !important;
    }

    .timeline-container {
        height: 200px;
    }

    .timeline-track {
        height: 160px;
    }

    #batterySvg {
        height: 160px !important;
    }

    #reserveLine {
        stroke-width: 3px;
    }

    .current-time-indicator {
        height: 180px;
        top: -10px;
    }

    .time-line {
        height: 100%;
    }

    .time-dot {
        top: 50%; /* Default position - will be updated by JavaScript */
        transform: translate(-50%, -50%);
        transition: top 0.5s ease; /* Smooth movement as battery percentage changes */
    }

    /* Mobile battery label adjustments */
    .battery-label {
        font-size: 0.8rem;
        min-width: 45px;
    }

    .point-marker {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .point-label {
        top: -50px;
        min-width: 70px;
        padding: 6px 10px;
    }

    .point-time {
        font-size: 0.8rem;
    }

    .point-name {
        font-size: 0.7rem;
    }

    .timeline-label {
        font-size: 0.7rem;
    }

    /* Force hide labels on mobile to reduce clutter */
    .schedule-point .point-label {
        opacity: 0 !important;
        transform: translateX(-50%) translateY(-10px) !important;
        display: none;
    }

    /* Show labels only on touch for mobile */
    .schedule-point:active .point-label {
        opacity: 1 !important;
        transform: translateX(-50%) translateY(0) !important;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(5px);
        display: block;
    }

    /* iPhone and small mobile optimizations */
    @media (max-width: 480px) {
        .timeline-container {
            height: 220px;
        }

        .timeline-track {
            height: 180px;
        }

        #batterySvg {
            height: 180px !important;
        }

        .current-time-indicator {
            height: 200px;
            top: -10px;
        }

        .time-line {
            height: 100%;
        }

        .time-dot {
            width: 10px;
            height: 10px;
            top: 50%; /* Default position - will be updated by JavaScript */
            transform: translate(-50%, -50%);
            transition: top 0.5s ease; /* Smooth movement as battery percentage changes */
        }

        /* Small mobile battery label adjustments */
        .battery-label {
            font-size: 0.75rem;
            min-width: 40px;
        }

        .point-marker {
            width: 30px;
            height: 30px;
            font-size: 0.9rem;
        }

        .point-label {
            top: -45px;
            min-width: 60px;
            padding: 4px 8px;
        }
    }
}

/* Weather Card */
.weather-info {
    text-align: center;
}

.weather-thumbnail {
    margin-bottom: 15px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.weather-thumbnail img {
    max-width: 90%;
    max-height: 120px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.weather-thumbnail img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.weather-condition {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.weather-confidence,
.weather-temp-humidity,
.weather-rain,
.weather-daylight,
.weather-timestamp {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.weather-temp-humidity,
.weather-rain {
    font-weight: 600;
    color: #7f8c8d;
}

.weather-temp-humidity span,
.weather-rain span {
    margin: 0 5px;
}

/* THW Index (feels like temperature) */
.weather-thw {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e67e22;
    margin-bottom: 5px;
    font-style: italic;
}

/* Daylight Information */
.weather-daylight {
    font-weight: 600;
    color: #7f8c8d;
    background: rgba(52, 152, 219, 0.05);
    padding: 8px;
    border-radius: 6px;
    margin: 8px 0;
}

.daylight-times {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.sunrise-time,
.sunset-time {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sunrise-time::before {
    content: "🌄";
    font-size: 1.8em;
    margin-right: 4px;
}

.sunset-time::before {
    content: "🌆";
    font-size: 1.8em;
    margin-right: 4px;
}

.daylight-duration {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #7f8c8d;
}

/* Chart Card */
.chart-card {
    grid-column: 1 / -1;
}

.chart-card + .chart-card {
    margin-top: 25px;
}

.chart-container {
    position: relative;
    height: 300px;
    margin-top: 15px;
}

#chartSelector, #currentDayChartSelector, #sevenDayChartSelector {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(52, 152, 219, 0.1);
    color: #2c3e50;
    font-weight: 500;
}

.current-day-info {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 5px;
    font-weight: 500;
}

/* Events Card */
.events-card {
    grid-column: 1 / -1;
    margin-top: 25px;
}

.events-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-item {
    padding: 15px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.event-time {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.event-description {
    font-weight: 500;
    color: #2c3e50;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .container {
        padding: 5px;
    }

    .header {
        padding: 12px 15px;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .card {
        padding: 15px;
    }

    .battery-percentage {
        font-size: 2rem;
    }

    .power-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .chart-container {
        height: 250px;
    }

    /* Hide grid charge time on mobile - not enough room */
    .grid-charge-time {
        display: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }

    .card,
    .header {
        background: rgba(44, 62, 80, 0.95);
        color: #ecf0f1;
    }

    .card-header h2,
    .battery-percentage,
    .power-value,
    .weather-condition,
    .event-description {
        color: #ecf0f1;
    }

    .weather-thw {
        color: #f39c12;
    }

    .battery-details > div,
    .power-item,
    .schedule-item,
    .event-item {
        background: rgba(52, 73, 94, 0.5);
    }

    .wall-connector-details .detail-value.ready {
        color: #bdc3c7;
    }
}

/* Loading animation */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.pulse {
    animation: pulse 1.5s infinite;
}

/* Image Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    margin: 5% auto;
    display: block;
    width: 90%;
    max-width: 800px;
    text-align: center;
    position: relative;
}

.modal-content img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-caption {
    margin: 15px 0;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 500;
}

.close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    padding: 5px 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.close:hover,
.close:focus {
    color: #ff6b6b;
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* Modal animations */
.modal.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.modal.hide {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Mobile modal adjustments */
@media (max-width: 480px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }

    .close {
        top: -35px;
        font-size: 30px;
    }

    .modal-caption {
        font-size: 1rem;
    }
}

/* Two Column Row Layout */
.two-column-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* Cards within two-column row should be contained */
.two-column-row .card {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

/* Override weather card full-width rules when in two-column row */
.two-column-row .weather-card {
    grid-column: unset !important;
}

/* Mobile responsive for two-column row */
@media (max-width: 768px) {
    .two-column-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Indoor Climate Card Styles */
.indoor-climate-card {
    /* Inherits background from .card - no need to override */
}

.indoor-climate-info {
    padding: 15px;
}

.thermostat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.thermostat-item:last-child {
    margin-bottom: 0;
}

.thermostat-name {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.1rem;
}

.thermostat-readings {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.thermostat-temp {
    font-size: 1.4rem;
    font-weight: 700;
    color: #27ae60;
    margin-bottom: 2px;
}

.thermostat-humidity {
    font-size: 0.9rem;
    color: #3498db;
    font-weight: 500;
}

.thermostat-mode {
    font-size: 0.85rem;
    color: #8e44ad;
    font-weight: 600;
    margin-top: 3px;
}

.thermostat-setpoints {
    font-size: 0.8rem;
    color: #e67e22;
    font-weight: 500;
    margin-top: 2px;
}

/* Mobile adjustments for thermostats */
@media (max-width: 480px) {
    .thermostat-item {
        padding: 12px;
    }

    .thermostat-name {
        font-size: 1rem;
    }

    .thermostat-temp {
        font-size: 1.2rem;
    }

    .thermostat-humidity {
        font-size: 0.8rem;
    }

    .thermostat-mode {
        font-size: 0.8rem;
    }

    .thermostat-setpoints {
        font-size: 0.75rem;
    }
}