/**
 * Leonics MOC - Fleet & Compare Styles
 * Ported from Clinics_4S style-fleet.css & compare.php
 */

/* Header Back Button */
.header-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    text-decoration: none;
}

.header-back-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateX(-2px);
}

.header-back-btn svg {
    flex-shrink: 0;
}

/* Fleet Page Layout */
.fleet-page, .compare-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.fleet-title-area {
    margin-bottom: 24px;
}

.fleet-title {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.fleet-subtitle {
    font-size: 13px;
    color: #64748b;
}

/* ---------- 1. FLEET MY SITES GRID ---------- */
.fleet-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.fleet-grid--three-cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.site-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.site-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.site-card.offline {
    opacity: 0.85;
}

.sc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sc-badge {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sc-badge-microgrid {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.sc-badge-peaksaving {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.sc-badge-offgrid {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.sc-type {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

.sc-name {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-loc {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* KPI Row */
.sc-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.sc-kpi {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.sc-kpi .lbl {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 2px;
}

.sc-kpi .val {
    font-family: 'DM Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.sc-kpi .val .u {
    font-size: 9px;
    color: #64748b;
    margin-left: 2px;
    font-weight: 500;
}

/* Status Row */
.sc-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.sc-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.sc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.sc-dot-ok {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.sc-dot-err {
    background: #ef4444;
}

.sc-time {
    font-size: 11px;
    color: #94a3b8;
    font-family: 'DM Mono', monospace;
}

/* ---------- 2. COMPARE SITES GRID ---------- */
.compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.cmp-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 22px 18px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.cmp-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.cmp-site {
    font-size: 12px;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ring-wrap {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 8px;
}

.ring-wrap svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-wrap .bg {
    fill: none;
    stroke: #f1f5f9;
    stroke-width: 9;
}

.ring-wrap .fg {
    fill: none;
    stroke-width: 9;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease-out;
}

.ring-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Mono', monospace;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.ring-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 18px;
}

.cmp-metric {
    margin-bottom: 10px;
    text-align: left;
    background: #f8fafc;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}

.cmp-metric .lbl {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 700;
    margin-bottom: 3px;
}

.cmp-metric .val {
    font-family: 'DM Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.cmp-metric .val .u {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
}

.bar-wrap {
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

/* Compare Summary Box */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sum-box {
    text-align: center;
    border-right: 1px solid #f1f5f9;
    padding: 0 10px;
}

.sum-box:last-child {
    border-right: none;
}

.sum-box .lbl {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.sum-box .val {
    font-family: 'DM Mono', monospace;
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
}

.sum-box .val .u {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    margin-left: 2px;
}

@media (max-width: 900px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    .sum-box:nth-child(2) {
        border-right: none;
    }
}

@media (max-width: 600px) {
    .fleet-grid, .compare-grid {
        grid-template-columns: 1fr;
    }
    .summary-grid {
        grid-template-columns: 1fr;
    }
    .sum-box {
        border-right: none;
        border-bottom: 1px solid #f1f5f9;
        padding-bottom: 12px;
    }
    .sum-box:last-child {
        border-bottom: none;
    }
}
