/* =============================================
   CAMPER CONTROL — Hoja de estilos global
   ============================================= */

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

:root {
    --primary:        #F59E0B;
    --primary-dark:   #D97706;
    --secondary:      #10B981;
    --warning:        #F59E0B;
    --danger:         #EF4444;
    --info:           #3B82F6;
    --bg-dark:        #0F172A;
    --bg-card:        #1E293B;
    --bg-hover:       #334155;
    --text-primary:   #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted:     #64748B;
    --border:         #334155;
    --shadow:         0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg:      0 8px 32px rgba(0,0,0,0.4);
    --radius:         16px;
    --radius-sm:      8px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed; left: 0; top: 0;
    width: 260px; height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    overflow-y: auto;
    z-index: 100;
}
.logo {
    display: flex; align-items: center; gap: 12px;
    padding: 0 12px 24px;
    border-bottom: 1px solid var(--border);
}
.logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-primary); font-size: 20px;
}
.logo-text { font-size: 22px; font-weight: 700; }
.logo-text span { color: var(--primary); }
.nav-menu { list-style: none; padding: 20px 0; }
.nav-item { margin: 4px 0; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}
.nav-link:hover,
.nav-link.active { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active { background: rgba(245,158,11,0.15); color: var(--primary); }
.nav-link i { width: 20px; text-align: center; font-size: 18px; }
.nav-section {
    padding: 16px 12px 8px;
    font-size: 11px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px;
}

/* ---- Main Content ---- */
.main-content { margin-left: 260px; padding: 24px 32px; }
.header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 32px;
}
.header-title h1 { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.header-title p { color: var(--text-secondary); font-size: 14px; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.search-box { position: relative; }
.search-box input {
    width: 280px; padding: 10px 16px 10px 40px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; color: var(--text-primary); font-size: 14px;
}
.search-box input:focus { outline: none; border-color: var(--primary); }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.quick-actions-header { display: flex; gap: 6px; }
.action-btn-header {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 14px;
    cursor: pointer; transition: all 0.2s;
}
.action-btn-header:hover { background: var(--primary); border-color: var(--primary); color: var(--text-primary); }

/* ---- Botones generales ---- */
.btn {
    padding: 10px 20px; border-radius: 10px;
    font-weight: 600; font-size: 13px;
    cursor: pointer; border: none; transition: all 0.2s;
    display: flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--primary); color: var(--text-primary); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-icon {
    width: 42px; height: 42px; padding: 0;
    border-radius: 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 16px;
    cursor: pointer; transition: all 0.2s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.user-avatar {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #DC2626);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-primary); font-weight: 600; cursor: pointer;
}

/* ---- Quick Actions ---- */
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.action-btn {
    padding: 12px 20px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text-secondary);
    font-weight: 500; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 8px;
}
.action-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--primary); }
.action-btn.active { background: var(--primary); border-color: var(--primary); color: var(--text-primary); }

/* ---- Section title ---- */
.section-title {
    font-size: 18px; font-weight: 600;
    margin: 32px 0 16px;
    display: flex; align-items: center; gap: 10px;
}
.section-title i { color: var(--primary); }

/* ---- Battery Hero ---- */
.battery-hero {
    background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(217,119,6,0.1));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px; margin-bottom: 24px;
}
.battery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.battery-title { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; }
.battery-status {
    font-size: 12px; padding: 4px 12px; border-radius: 6px;
    background: rgba(16,185,129,0.15); color: var(--secondary); font-weight: 600;
}
.battery-main { display: flex; align-items: center; gap: 24px; }
.battery-icon {
    width: 80px; height: 80px; background: var(--bg-card); border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; color: var(--primary);
}
.battery-info { flex: 1; }
.battery-percent { font-size: 42px; font-weight: 700; color: var(--primary); line-height: 1; margin-bottom: 8px; }
.battery-details { display: flex; gap: 24px; margin-bottom: 12px; }
.battery-detail { font-size: 14px; color: var(--text-secondary); }
.battery-detail span { color: var(--text-primary); font-weight: 600; }
.battery-bar { height: 8px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.battery-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); border-radius: 4px; transition: width 0.3s; }

/* ---- Stats Grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; transition: all 0.3s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-icon.water  { background: rgba(59,130,246,0.15); color: var(--info); }
.stat-icon.gas    { background: rgba(245,158,11,0.15); color: var(--warning); }
.stat-icon.temp   { background: rgba(239,68,68,0.15);  color: var(--danger); }
.stat-icon.solar  { background: rgba(251,191,36,0.15); color: #FBBF24; }
.stat-value { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-secondary); }

/* ---- Zones / Lights ---- */
.zones-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 24px; }
.zone-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.zone-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.zone-info { display: flex; align-items: center; gap: 12px; }
.zone-icon { width: 40px; height: 40px; background: var(--bg-hover); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--primary); }
.zone-name { font-weight: 600; font-size: 16px; }
.zone-temp { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.zone-temp i { color: var(--danger); }
.lights-list { display: flex; flex-direction: column; gap: 10px; }
.light-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: var(--bg-hover); border-radius: var(--radius-sm); }
.light-info { display: flex; align-items: center; gap: 12px; }
.light-icon { width: 36px; height: 36px; background: var(--bg-card); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--warning); }
.light-icon.off { color: var(--text-muted); }
.light-name { font-weight: 500; font-size: 14px; }
.light-status { font-size: 12px; color: var(--text-secondary); margin-left: 8px; }

/* ---- Toggle Switch ---- */
.toggle-switch { position: relative; width: 50px; height: 28px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-dark); border-radius: 28px; transition: 0.3s; border: 1px solid var(--border); }
.toggle-slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 2px; bottom: 2px; background: var(--text-muted); border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); border-color: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); background: var(--text-primary); }

/* ---- Tanks ---- */
.tanks-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.tank-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.tank-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tank-info { display: flex; align-items: center; gap: 12px; }
.tank-icon { width: 40px; height: 40px; background: var(--bg-hover); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.tank-icon.clean { color: #3B82F6; }
.tank-icon.grey  { color: #6B7280; }
.tank-icon.black { color: #1F2937; }
.tank-name { font-weight: 600; font-size: 15px; }
.tank-percent { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.tank-bar { height: 10px; background: var(--bg-hover); border-radius: 5px; overflow: hidden; margin-bottom: 12px; }
.tank-fill { height: 100%; border-radius: 5px; transition: width 0.3s; }
.tank-fill.clean { background: linear-gradient(90deg, #3B82F6, #60A5FA); }
.tank-fill.grey  { background: linear-gradient(90deg, #6B7280, #9CA3AF); }
.tank-fill.black { background: linear-gradient(90deg, #1F2937, #4B5563); }
.tank-details { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }

/* ---- Climate ---- */
.climate-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 16px; margin-bottom: 24px; }
.climate-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.climate-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.climate-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.climate-modes { display: flex; gap: 6px; }
.mode-btn { padding: 6px 14px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; color: var(--text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.mode-btn.active { background: var(--primary); border-color: var(--primary); color: var(--text-primary); }
.thermostat { display: flex; align-items: center; justify-content: center; gap: 30px; margin-bottom: 20px; }
.temp-control { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.temp-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-primary); font-size: 18px; cursor: pointer; transition: all 0.2s; }
.temp-btn:hover { background: var(--primary); border-color: var(--primary); }
.temp-display { text-align: center; }
.temp-value { font-size: 52px; font-weight: 700; color: var(--primary); line-height: 1; }
.temp-unit { font-size: 20px; color: var(--text-secondary); }
.climate-info { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.info-item { text-align: center; }
.info-value { font-size: 18px; font-weight: 600; }
.info-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ---- Solar ---- */
.solar-section { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.solar-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.solar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.solar-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.solar-status { font-size: 11px; padding: 4px 10px; border-radius: 6px; background: rgba(16,185,129,0.15); color: var(--secondary); font-weight: 600; }
.chart-container { position: relative; height: 250px; }
.solar-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 16px; }
.solar-stat { text-align: center; padding: 16px; background: var(--bg-hover); border-radius: var(--radius-sm); }
.solar-icon { font-size: 22px; margin-bottom: 8px; color: #FBBF24; }
.solar-value { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.solar-label { font-size: 12px; color: var(--text-secondary); }

/* ---- Security ---- */
.security-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.security-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.sensors-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.sensor-item { display: flex; justify-content: space-between; align-items: center; padding: 14px; background: var(--bg-hover); border-radius: var(--radius-sm); }
.sensor-info { display: flex; align-items: center; gap: 12px; }
.sensor-icon { width: 36px; height: 36px; background: var(--bg-card); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.sensor-icon.open   { color: var(--warning); }
.sensor-icon.closed { color: var(--secondary); }
.sensor-name { font-weight: 500; font-size: 14px; }
.sensor-status { font-size: 12px; padding: 4px 10px; border-radius: 6px; font-weight: 600; }
.sensor-status.open   { background: rgba(245,158,11,0.15); color: var(--warning); }
.sensor-status.closed { background: rgba(16,185,129,0.15); color: var(--secondary); }
.alarm-section { text-align: center; }
.alarm-status { font-size: 64px; margin-bottom: 12px; }
.alarm-status.armed    { color: var(--warning); }
.alarm-status.disarmed { color: var(--secondary); }
.alarm-label { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.alarm-btn { width: 100%; padding: 16px; border-radius: 12px; border: none; font-weight: 600; font-size: 15px; cursor: pointer; transition: all 0.2s; }
.alarm-btn.arm    { background: var(--warning); color: var(--text-primary); }
.alarm-btn.disarm { background: var(--danger);  color: var(--text-primary); }
.alarm-btn:hover  { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ---- Responsive ---- */
@media (max-width: 1200px) {
    .solar-section   { grid-template-columns: 1fr; }
    .security-grid   { grid-template-columns: 1fr; }
}
@media (max-width: 992px) {
    .sidebar         { width: 80px; padding: 24px 8px; }
    .logo-text, .nav-section, .nav-link span { display: none; }
    .nav-link        { justify-content: center; }
    .main-content    { margin-left: 80px; }
}
@media (max-width: 768px) {
    .sidebar         { display: none; }
    .main-content    { margin-left: 0; padding: 16px; }
    .header          { flex-direction: column; gap: 16px; align-items: flex-start; }
    .search-box input { width: 100%; }
    .stats-grid      { grid-template-columns: repeat(2,1fr); }
    .zones-grid      { grid-template-columns: 1fr; }
    .climate-section { grid-template-columns: 1fr; }
}
