/* Finezzi Family Portal — Navy + Gold */
:root {
    --navy: #0a1628;
    --navy-light: #122240;
    --navy-mid: #1a2d4a;
    --gold: #c9a84c;
    --gold-light: #e8d48b;
    --gold-dim: #8a7333;
    --text: #e8e6e3;
    --text-muted: #8a9ab5;
    --green: #4ade80;
    --red: #f87171;
    --amber: #fbbf24;
    --blue: #60a5fa;
    --card-bg: rgba(18, 34, 64, 0.7);
    --card-border: rgba(201, 168, 76, 0.15);
}

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

body {
    font-family: 'Raleway', sans-serif;
    background: var(--navy);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    border-bottom: 1px solid var(--card-border);
    padding: 1.2rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--gold);
}

.header h1 span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 1.1rem;
}

.crest {
    width: 40px;
    height: 40px;
    border-radius: 4px;
}

.last-updated {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    margin-right: 0.4rem;
    animation: pulse 2s infinite;
}

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

/* Main content */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Location sections */
.location-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.location {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    backdrop-filter: blur(10px);
}

.location-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}

.location-header h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    color: var(--gold);
    font-weight: 600;
}

.location-header .mode-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(201, 168, 76, 0.15);
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Metric cards */
.metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.metric {
    background: rgba(10, 22, 40, 0.5);
    border: 1px solid rgba(201, 168, 76, 0.08);
    border-radius: 8px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.metric-icon {
    font-size: 1.1rem;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.metric-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* SOC gauge */
.soc-bar {
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.3rem;
}

.soc-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease, background 0.5s ease;
}

/* Water section */
.water-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.water-section h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    color: var(--gold);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}

.water-bar {
    height: 24px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 0.5rem;
}

.water-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: 12px;
    transition: width 0.8s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    min-width: 3rem;
}

.water-stats {
    display: flex;
    gap: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Charts */
.chart-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.chart-section h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    color: var(--gold);
    margin-bottom: 0.75rem;
}

.chart-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.chart-tab {
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Raleway', sans-serif;
    transition: all 0.2s;
}

.chart-tab.active, .chart-tab:hover {
    background: rgba(201, 168, 76, 0.15);
    color: var(--gold);
    border-color: var(--gold-dim);
}

.chart-container {
    position: relative;
    height: 250px;
}

/* Property tabs */
.property-tabs {
    display: flex;
    gap: 0.4rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 0.4rem;
}

.property-tab {
    flex: 1;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.property-tab.active {
    background: rgba(201, 168, 76, 0.12);
    color: var(--gold);
    border-color: var(--gold-dim);
}

.property-tab:hover:not(.active) {
    background: rgba(255,255,255,0.03);
    color: var(--text);
}

/* Property panels */
.property-panel {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

.property-panel.active {
    display: flex;
}

/* No data message */
.no-data-msg {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.no-data-msg p:first-child {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
    .location-row {
        grid-template-columns: 1fr;
    }
    .header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    .dashboard {
        padding: 1rem;
    }
    .metrics {
        grid-template-columns: 1fr 1fr;
    }
}

/* Loading / error states */
.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.error-banner {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--red);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    display: none;
}
