:root {
    --primary-color: #0284c7; /* sky-500 */
    --primary-color-dark: #0369a1; /* sky-600 */
    --primary-color-light: #e0f2fe; /* sky-100 */
    
    --secondary-color: #f59e0b; /* amber-500 */
    
    --success-color: #16a34a; /* green-600 */
    --warning-color: #d97706; /* amber-600 */
    --danger-color: #dc2626; /* red-600 */
    --info-color: #0ea5e9; /* sky-500 */

    --text-primary: #1e293b; /* slate-800 */
    --text-secondary: #475569; /* slate-600 */
    --text-muted: #64748b; /* slate-500 */
    
    --bg-main: #f1f5f9; /* slate-100 */
    --bg-card: #ffffff;
    --border-color: #e2e8f0; /* slate-200 */
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body.menu-open { overflow: hidden; }

h1, h2, h3, h4, h5, h6 { color: var(--text-primary); font-weight: 700; }
.page-title { font-size: 1.75rem; font-weight: 800; }
.section-title { font-size: 1.5rem; margin-bottom: 1.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-color); }

/* HEADER */
.header-main {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 1020;
}
.header-brand {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: var(--text-primary);
    font-weight: 700; font-size: 1.5rem;
}
.header-brand-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--bg-card); font-size: 1.5rem;
}
.nav-tabs-custom { border: none; gap: 4px; }
.nav-tabs-custom .nav-link {
    border: none; color: var(--text-secondary);
    font-weight: 500; padding: 0.6rem 1rem;
    border-radius: 8px; transition: all 0.2s;
    font-size: 0.9rem;
}
.nav-tabs-custom .nav-link:hover { color: var(--primary-color); background: var(--primary-color-light); }
.nav-tabs-custom .nav-link.active {
    color: var(--primary-color); background: var(--primary-color-light);
    font-weight: 600;
}
.header-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: 1rem; }
.btn-icon {
    background: transparent; border: none; color: var(--text-muted);
    width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.2rem; cursor: pointer; transition: all 0.2s;
}
.btn-icon:hover { background: var(--bg-main); color: var(--text-primary); }

.status-indicator {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px;
    background: var(--success-color); color: var(--bg-card);
    border-radius: 6px; font-size: 0.9rem; font-weight: 600; margin-left: 1rem;
}
.status-dot { width: 8px; height: 8px; background: var(--bg-card); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* MOBILE MENU */
.mobile-menu {
    position: fixed; top: 68px; left: 0; width: 100%; height: calc(100vh - 68px);
    background: var(--bg-card); z-index: 1010;
    padding: 1.5rem;
    transform: translateX(-100%); transition: transform 0.3s ease-in-out;
    display: flex; flex-direction: column; gap: 0.5rem;
    overflow-y: auto;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu .nav-link { font-size: 1.1rem; padding: 0.75rem; }

/* CARDS & CONTAINERS */
.card-professional {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px; box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s;
    border-top: 4px solid var(--primary-color);
    height: 100%;
}
.card-professional:hover { box-shadow: var(--shadow-md); }
.card-header-custom {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.card-header-custom h5 { margin: 0; font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.card-body-custom { padding: 1.5rem; }

/* METRIC CARDS */
.metric-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.5rem;
    box-shadow: var(--shadow-sm); transition: all 0.3s;
    display: flex; align-items: center; gap: 1rem;
}
.metric-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.metric-icon {
    width: 48px; height: 48px; min-width: 48px;
    border-radius: 10px; display: flex; align-items: center;
    justify-content: center; font-size: 1.5rem;
}
.metric-icon.primary { background: var(--primary-color-light); color: var(--primary-color); }
.metric-icon.success { background: #dcfce7; color: var(--success-color); }
.metric-icon.warning { background: #fef3c7; color: var(--warning-color); }
.metric-icon.secondary { background: #fef3c7; color: var(--secondary-color); }
.metric-label { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; margin-bottom: 0.25rem; }
.metric-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.metric-value small { font-size: 1rem; color: var(--text-muted); }
.metric-change { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; margin-top: 0.5rem; font-weight: 500; }
.metric-change.positive { color: var(--success-color); }

/* FORMS & FILTERS */
.search-input {
    width: 100%; padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 1px solid var(--border-color); border-radius: 8px;
    font-size: 1rem; transition: all 0.2s; background: var(--bg-main);
}
.search-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-color-light); }
.search-icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
    padding: 0.5rem 1rem; border: 1px solid var(--border-color);
    background: var(--bg-card); color: var(--text-secondary);
    border-radius: 8px; font-size: 0.9rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.filter-btn.active { background: var(--primary-color); color: var(--bg-card); border-color: var(--primary-color); }
.form-select { background-color: var(--bg-main); border-color: var(--border-color); }

/* TABLES */
.table-professional { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-professional thead th {
    background: var(--bg-main); color: var(--text-secondary);
    font-weight: 600; font-size: 0.85rem; text-transform: uppercase;
    letter-spacing: 0.5px; padding: 0.75rem 1.25rem;
    border-bottom: 2px solid var(--border-color); text-align: left;
}
.table-professional tbody td { padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border-color); font-size: 0.95rem; vertical-align: middle; }
.table-professional tbody tr:hover { background: var(--primary-color-light); }
.table-professional th.sortable { cursor: pointer; }
.table-professional th.sortable::after { content: ' \\2195'; opacity: 0.3; }
.table-professional th.sortable.asc::after { content: ' \\25B2'; opacity: 1; }
.table-professional th.sortable.desc::after { content: ' \\25BC'; opacity: 1; }
.pagination .page-item.active .page-link { background-color: var(--primary-color); border-color: var(--primary-color); }
.pagination .page-link { color: #000000; }

/* BADGES & ALERTS */
.badge-custom {
    padding: 5px 12px; border-radius: 100px;
    font-size: 0.85rem; font-weight: 600;
    text-transform: capitalize;
}
.badge-custom.active, .badge-custom.success { background: #dcfce7; color: #15803d; }
.badge-custom.warning { background: #fef3c7; color: #b45309; }
.badge-custom.danger { background: #fee2e2; color: #b91c1c; }
.alert-custom {
    padding: 1.25rem; border-radius: 8px;
    border-left: 5px solid; display: flex;
    align-items: flex-start; gap: 1rem;
}
.alert-custom.info { background: var(--primary-color-light); border-color: var(--info-color); color: var(--primary-color-dark); }
.alert-custom.success { background: #dcfce7; border-color: var(--success-color); color: #14532d; }
.alert-custom.warning { background: #fef3c7; border-color: var(--warning-color); color: #78350f; }
.alert-icon { font-size: 1.5rem; margin-top: 2px; }

/* WIDGETS */
.weather-widget { background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark)); border-radius: 12px; padding: 1.5rem; color: #fff; box-shadow: var(--shadow-md); }
.weather-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.weather-icon-large { font-size: 3rem; }
.weather-temp { font-size: 2.5rem; font-weight: 700; line-height: 1; }
.weather-condition { font-size: 1rem; opacity: 0.9; }
.weather-details { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.2); }
.weather-detail-item { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.weather-detail-item i { font-size: 1.2rem; opacity: 0.8; }
.weather-detail-label { font-size: 0.8rem; opacity: 0.8; }
.weather-detail-value { font-weight: 600; }

.ai-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.ai-metric { text-align: center; padding: 1rem; background: var(--bg-main); border-radius: 8px; }
.ai-metric-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ai-metric-value { font-size: 1.5rem; font-weight: 700; margin-top: 0.5rem; }

/* SINGLE PANEL PAGE */
.lifetime-value { font-size: 3.5rem; font-weight: 800; line-height: 1; }
.info-box { padding: 1rem; background: var(--bg-main); border-radius: 8px; height: 100%; }
.info-box-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.info-box-value { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); }
.btn-icon-sm { width: 32px; height: 32px; font-size: 1rem; }
#panelNameContainer input { transition: all 0.2s; }
.list-group-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; }

/* THERMAL MAP PAGE */
.thermal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    padding: 1rem;
    background-color: var(--bg-main);
    border-radius: 8px;
}
.thermal-panel {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(0,0,0,0.1);
    position: relative;
}
.thermal-panel:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.thermal-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-primary);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 20;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.thermal-panel:hover .thermal-tooltip {
    visibility: visible;
    opacity: 1;
}

/* UTILITIES */
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }
.text-secondary { color: var(--secondary-color); }

.chart-container { position: relative; width: 100%; min-height: 300px; }

/* ANIMATIONS */
.rotating { animation: spin 1s linear; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
