:root {
    --bg-color: #eef2f5;
    --card-bg: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --accent-blue: #3498db;
    --color-red: #e74c3c;
    --color-green: #2ecc71;
    --color-orange: #f39c12;
    --color-gray: #bdc3c7;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 15px;
    transition: background-color 0.5s ease;
}

.container {
    max-width: 500px;
    margin: 0 auto;
}

.header h2 {
    text-align: center;
    opacity: 0.8;
    margin-bottom: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Zone Grid */
.zone-grid-header {
    display: grid;
    grid-template-columns: 15% 45% 20% 20%;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.zone-row {
    display: grid;
    grid-template-columns: 15% 45% 20% 20%;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.95rem;
}
.zone-row:last-child { border-bottom: none; }
.zone-icon { text-align: center; }

/* Status Text Colors */
.text-red { color: var(--color-red) !important; }
.text-green { color: var(--color-green) !important; }
.text-orange { color: var(--color-orange) !important; }
.text-gray { color: var(--color-gray) !important; }
.text-center { text-align: center; }

/* Flex Utilities */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-15 { margin-top: 15px; }
.mb-15 { margin-bottom: 15px; }
.hide { display: none; }

.status-badge {
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    background: #f8f9fa;
}

/* Alarm Status Indicators */
.status-indicators {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Modern Toggle Switch */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-weight: 500;
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--color-gray);
    transition: .3s;
    border-radius: 28px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px; width: 20px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-blue); }
input:checked + .slider:before { transform: translateX(24px); }

/* Buttons */
.btn {
    padding: 15px 10px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    width: 100%;
    transition: 0.1s transform;
}
.btn:active { transform: scale(0.96); }

.btn-primary { background: var(--accent-blue); color: white; }
.btn-danger { background: var(--color-red); color: white; }
.btn-secondary { background: #e0e6ed; color: var(--text-main); }
.btn-disabled { background: #f0f0f0; color: #aaa; cursor: not-allowed; }

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

/* --- NEW FORMS & LOGIN STYLES --- */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-main);
    background: var(--card-bg);
    box-sizing: border-box;
    transition: border-color 0.3s;
}

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

.text-error {
    color: var(--color-red);
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

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

.header-actions h2 { margin: 0; }

.btn-sm {
    padding: 8px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* --- UI MODE TOGGLE & BASIC MODE STYLES --- */
.mode-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    background: var(--card-bg);
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.mode-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 0.3s;
}

/* Basic Mode Specific Backgrounds */
body.mode-basic.bg-green { background-color: #d1e7dd; }
body.mode-basic.bg-red { background-color: #f8d7da; }
body.mode-basic.bg-orange { background-color: #fff3cd; }

body.mode-basic .full-only { display: none !important; }

body.mode-basic .garage-card {
    margin-top: 20px;
    padding: 40px 20px;
}
body.mode-basic .garage-card .flex-between { flex-direction: column; gap: 20px; }
body.mode-basic .garage-card h3 { font-size: 1.8rem; margin-bottom: 0; }
body.mode-basic .garage-card .status-badge { font-size: 1.3rem; padding: 12px 25px; border-radius: 30px; }
body.mode-basic .garage-card .btn-grid { display: flex; flex-direction: column; gap: 15px; margin-top: 35px; }
body.mode-basic .garage-card .btn { padding: 20px; font-size: 1.2rem; border-radius: 16px; }

/* --- TAB NAVIGATION & AIRCON SCHEDULES --- */
.nav-segmented {
    display: flex;
    background-color: #e0e6ed;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.nav-tab {
    flex: 1; background: transparent; border: none; color: var(--text-muted);
    padding: 10px 0; font-size: 14px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: all 0.2s ease;
}

.nav-tab i { margin-right: 5px; }
.nav-tab.active { background-color: var(--accent-blue); color: white; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.schedule-item {
    background: #f8f9fa; border: 1px solid #e0e6ed; padding: 12px 15px; border-radius: 12px;
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
    font-size: 14px; box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

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

.modal-content {
    background: var(--card-bg); border-radius: 16px; padding: 25px 20px; width: 100%;
    max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.day-checkboxes { display: flex; justify-content: space-between; width: 100%; }
.day-checkboxes label { display: flex; flex-direction: column; align-items: center; font-size: 12px; font-weight: 600; color: var(--text-main); cursor: pointer; }
.day-checkboxes input { margin-top: 6px; }
.btn-quick-timer { flex: 1; font-size: 0.9rem; padding: 12px 4px; }

/* Modal Action Box (ON/OFF Slider & Time Picker) */
.modal-action-box {
    display: flex; align-items: center; gap: 8px; 
    background: var(--bg-color); padding: 10px 15px; 
    border-radius: 10px; flex: 1; justify-content: center; 
    border: 2px solid #e0e6ed; position: relative;
}

.modal-action-box i { color: var(--accent-blue); font-size: 1.2rem; }

.time-input {
    background: transparent; border: none; font-size: 1rem; 
    font-weight: 600; color: var(--text-main); outline: none; width: 100%;
    text-align: center;
}

/* Make the native time picker clickable area cover the entire box on mobile */
.time-input::-webkit-calendar-picker-indicator {
    background: transparent; bottom: 0; color: transparent; cursor: pointer;
    height: auto; left: 0; position: absolute; right: 0; top: 0; width: auto;
}
