/* ============================================================
   EcoG CSMS — Design System
   Primary:   #B9CD00  (lime green)
   Dark:      #444638  (charcoal)
   BG:        #f0f1eb  (warm off-white)
   ============================================================ */

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Open Sans', system-ui, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #3a3d2e;
    background: #f0f1eb;
    margin: 0;
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar-ecog {
    background-color: #444638;
    border-bottom: 3px solid #B9CD00;
    min-height: 64px;
    padding: 0 0;
}
.navbar-ecog .navbar-brand {
    padding: 10px 16px;
}
.navbar-ecog .navbar-brand img {
    height: 40px;
    width: auto;
}
.navbar-ecog .nav-link {
    color: rgba(255,255,255,0.7) !important;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 8px 14px !important;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.navbar-ecog .nav-link:hover {
    color: #B9CD00 !important;
    background: rgba(185,205,0,0.08);
}
.navbar-ecog .nav-link.active {
    color: #B9CD00 !important;
}
.navbar-ecog .navbar-toggler {
    border-color: rgba(185,205,0,0.4);
}
.navbar-ecog .navbar-toggler-icon {
    filter: invert(1);
}

/* ── Flash messages ────────────────────────────────────────── */
.flash-bar {
    background: #444638;
    padding: 0 24px;
}
.flash-msg {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    color: #B9CD00;
    font-size: 0.83rem;
    border-bottom: 1px solid rgba(185,205,0,0.15);
}
.flash-msg:last-child { border-bottom: none; }
.flash-close {
    background: none;
    border: none;
    color: rgba(185,205,0,0.6);
    cursor: pointer;
    padding: 0 4px;
    font-size: 0.8rem;
}
.flash-close:hover { color: #B9CD00; }

/* ── Page shell ────────────────────────────────────────────── */
.dash-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 28px 60px;
}

/* ── Page header ───────────────────────────────────────────── */
.dash-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dde0d5;
}
.dash-title {
    font-size: 1.55rem;
    font-weight: 800;
    color: #444638;
    margin: 0;
    letter-spacing: -0.01em;
}
.dash-subtitle {
    font-size: 0.8rem;
    color: #8a8d7a;
    margin: 3px 0 0;
    letter-spacing: 0.02em;
}
.dash-header-right {
    font-size: 1.1rem;
    font-weight: 700;
    color: #B9CD00;
    font-family: 'Consolas', monospace;
    background: #444638;
    padding: 6px 16px;
    border-radius: 8px;
}

/* ── Stat cards ────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 18px;
    border-top: 4px solid transparent;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.10), 0 8px 24px rgba(0,0,0,0.06);
}
.stat-card--total    { border-top-color: #B9CD00; }
.stat-card--connected { border-top-color: #22c55e; }
.stat-card--offline  { border-top-color: #94a3b8; }

.stat-card__icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-card--total    .stat-card__icon { background: rgba(185,205,0,0.12);  color: #8fa000; }
.stat-card--connected .stat-card__icon { background: rgba(34,197,94,0.1);   color: #16a34a; }
.stat-card--offline  .stat-card__icon { background: rgba(148,163,184,0.12); color: #64748b; }

.stat-card__value {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    color: #444638;
    letter-spacing: -0.02em;
}
.stat-card__label {
    font-size: 0.74rem;
    color: #9a9d8a;
    font-weight: 600;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* ── Table card ────────────────────────────────────────────── */
.table-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    overflow: hidden;
}
.table-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 14px;
    border-bottom: 1px solid #f0f1eb;
}
.table-card__title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #444638;
    margin: 0;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Dashboard table ───────────────────────────────────────── */
.dash-table {
    margin: 0;
    font-size: 0.85rem;
}
.dash-table thead th {
    background: #fafafa;
    color: #8a8d7a;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 10px 20px;
    border-bottom: 2px solid #f0f1eb;
    border-top: none;
    white-space: nowrap;
}
.dash-table tbody tr {
    border-bottom: 1px solid #f5f6f2;
    transition: background 0.1s;
}
.dash-table tbody tr:hover {
    background: #fafaf7;
}
.dash-table tbody td {
    padding: 12px 20px;
    vertical-align: middle;
    border: none;
}
.dash-table tbody tr:last-child { border-bottom: none; }

/* ── Station log link ──────────────────────────────────────── */
a.station-log-link {
    color: #3a3d2e;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: color 0.15s;
}
a.station-log-link:hover {
    color: #8fa000;
}

/* ── Status badges ─────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-connected  { background: rgba(34,197,94,0.10);  color: #16a34a; }
.status-connected  .status-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.2); }
.status-available  { background: rgba(148,163,184,0.12); color: #64748b; }
.status-available  .status-dot { background: #94a3b8; }
.status-charging   { background: rgba(185,205,0,0.12);  color: #8fa000; }
.status-charging   .status-dot { background: #B9CD00; box-shadow: 0 0 0 3px rgba(185,205,0,0.2); }
.status-activity   { background: rgba(99,102,241,0.10); color: #4f46e5; }
.status-activity   .status-dot { background: #6366f1; }
.status-unknown    { background: rgba(239,68,68,0.08);  color: #dc2626; }
.status-unknown    .status-dot { background: #ef4444; }

/* ── Set-point button ──────────────────────────────────────── */
.btn-setpoint {
    background: transparent;
    border: 1.5px solid #dde0d5;
    color: #8a8d7a;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-setpoint:hover:not([disabled]) {
    border-color: #B9CD00;
    color: #8fa000;
    background: rgba(185,205,0,0.07);
}
.btn-setpoint[disabled] {
    opacity: 0.4;
    cursor: default;
}

/* ── Section headers (local frequency etc.) ────────────────── */
.section-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #444638;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 28px 0 14px;
}

/* ── Canvas / charts ───────────────────────────────────────── */
canvas {
    margin: auto;
    width: 500px;
}

/* ── DataTables overrides ──────────────────────────────────── */
.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid #dde0d5;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.82rem;
    outline: none;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #B9CD00;
    box-shadow: 0 0 0 3px rgba(185,205,0,0.15);
}
.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid #dde0d5;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.82rem;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-size: 0.78rem;
    padding: 12px 20px;
    color: #9a9d8a;
}
.dataTables_wrapper .paginate_button {
    border-radius: 6px !important;
    font-size: 0.78rem !important;
}
.dataTables_wrapper .paginate_button.current,
.dataTables_wrapper .paginate_button.current:hover {
    background: #B9CD00 !important;
    border-color: #B9CD00 !important;
    color: #444638 !important;
}

/* ── Log viewer (used in log.html / station_log.html) ──────── */
.logging_window {
    display: block;
    padding: 9.5px;
    font-size: 13px;
    line-height: 1.42857143;
    color: #333;
    word-break: break-all;
    word-wrap: break-word;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    margin: auto;
    overflow-y: scroll;
    height: 400px;
}

/* ── Add Charge Point button ───────────────────────────────── */
.btn-add-cp {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #B9CD00;
    color: #444638;
    border: none;
    border-radius: 10px;
    padding: 9px 20px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(185,205,0,0.3);
}
.btn-add-cp:hover {
    background: #a8bc00;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(185,205,0,0.4);
}
.btn-add-cp:active { transform: translateY(0); }

/* ── Add CP modal ──────────────────────────────────────────── */
.add-cp-modal {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.add-cp-modal__header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 24px 16px;
    background: #444638;
    border-bottom: 3px solid #B9CD00;
}
.add-cp-modal__icon {
    width: 46px;
    height: 46px;
    background: rgba(185,205,0,0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #B9CD00;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.add-cp-modal__title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 3px;
}
.add-cp-modal__sub {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin: 0;
}
.add-cp-modal__close {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.15s;
}
.add-cp-modal__close:hover { color: #fff; }

.add-cp-modal__body {
    padding: 24px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.add-cp-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    background: #fafaf7;
    border-top: 1px solid #f0f1eb;
}

/* ── Form fields ───────────────────────────────────────────── */
.cp-field__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6a6d5a;
    margin-bottom: 7px;
}
.cp-field__required { color: #B9CD00; }
.cp-field__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.cp-field__icon {
    position: absolute;
    left: 12px;
    color: #aaa;
    font-size: 0.8rem;
    pointer-events: none;
}
.cp-field__input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1.5px solid #dde0d5;
    border-radius: 9px;
    font-size: 0.88rem;
    color: #3a3d2e;
    background: #fafaf7;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    font-family: inherit;
}
.cp-field__input:focus {
    border-color: #B9CD00;
    box-shadow: 0 0 0 3px rgba(185,205,0,0.15);
    background: #fff;
}
.cp-field__input::placeholder { color: #bbb; }
.cp-field__toggle-pwd {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 4px;
    font-size: 0.8rem;
    transition: color 0.15s;
}
.cp-field__toggle-pwd:hover { color: #444638; }
.cp-field__hint {
    font-size: 0.72rem;
    color: #aaa;
    margin: 5px 0 0;
}

/* ── Preview card ──────────────────────────────────────────── */
.cp-preview {
    background: #f7f8f3;
    border: 1.5px solid #e8ebdf;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cp-preview__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}
.cp-preview__key {
    color: #9a9d8a;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
}
.cp-preview__val {
    font-weight: 700;
    color: #3a3d2e;
    font-family: monospace;
    font-size: 0.85rem;
}

/* ── Modal action buttons ──────────────────────────────────── */
.btn-cp-cancel {
    background: transparent;
    border: 1.5px solid #dde0d5;
    color: #8a8d7a;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.btn-cp-cancel:hover { border-color: #aaa; color: #444638; }

.btn-cp-submit {
    background: #B9CD00;
    color: #444638;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(185,205,0,0.25);
}
.btn-cp-submit:hover:not([disabled]) {
    background: #a8bc00;
    box-shadow: 0 4px 12px rgba(185,205,0,0.35);
}
.btn-cp-submit[disabled] {
    background: #e0e3d4;
    color: #aaa;
    box-shadow: none;
    cursor: not-allowed;
}

/* ── Misc legacy helpers kept for compatibility ────────────── */
.set-radius-zero { border-radius: 0; }
.pad-botm        { padding-bottom: 30px; }
.header-line {
    font-weight: 900;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7de;
    text-transform: uppercase;
    color: #444638;
}
.content-wrapper {
    margin-top: 0;
    min-height: 400px;
    padding-bottom: 40px;
}
