/* ============================================================
   AWARE Admin — Compact, information-dense admin styling
   Builds on design tokens from dashboard.css
   ============================================================ */

/* --- Login Page ---------------------------------------------- */
.admin-login-body {
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    height: 48px;
    margin-bottom: 0.75rem;
}

.login-header h1 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-1);
    margin: 0;
}

.login-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red);
    border-radius: var(--r-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-form label {
    display: block;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 0.3rem;
}

.login-form input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text-1);
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--eth-blue);
    box-shadow: 0 0 0 2px var(--eth-blue-muted);
}

.login-btn {
    width: 100%;
    padding: 0.65rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-inv);
    background: var(--eth-blue);
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.15s;
}

.login-btn:hover {
    background: var(--eth-blue-dark);
}

.login-footer {
    text-align: center;
    margin-top: 1.25rem;
}

.lang-toggle-small {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-3);
    cursor: pointer;
}

/* --- Admin Header -------------------------------------------- */
.admin-header {
    background: var(--slate-900);
}

.admin-footer .footer-inner {
    justify-content: center;
}

.nav-logout {
    opacity: 0.6;
}
.nav-logout:hover {
    opacity: 1;
}

.nav-link.active {
    opacity: 1;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 2px;
}

/* --- Admin Main Layout --------------------------------------- */
.admin-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.admin-page {
    width: 100%;
}

.admin-page-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.admin-page-header h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-1);
    margin: 0;
}

.admin-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-3);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.15rem 0.5rem;
}

.admin-breadcrumb {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--text-3);
    margin-bottom: 0.75rem;
}

.admin-breadcrumb a {
    color: var(--eth-blue);
    text-decoration: none;
}
.admin-breadcrumb a:hover {
    text-decoration: underline;
}

/* --- Info Bar ------------------------------------------------ */
.admin-info-bar {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.5rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.8rem;
    color: var(--text-2);
}

.info-bar-error {
    color: var(--red);
    font-weight: 600;
}

/* --- Admin Tables -------------------------------------------- */
.admin-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.82rem;
}

.admin-table th {
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-3);
    background: var(--surface-2);
    border-bottom: 2px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
    white-space: nowrap;
}

.admin-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: var(--surface-2);
}

.mono-cell {
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.station-name-cell {
    font-family: var(--font-mono);
    font-weight: 500;
}

.admin-link {
    color: var(--eth-blue);
    text-decoration: none;
    font-weight: 500;
}
.admin-link:hover {
    text-decoration: underline;
}

/* Row highlights */
.row-error {
    background: var(--red-bg) !important;
}
.row-warn {
    background: var(--yellow-bg) !important;
}

/* Count badges */
.count-error {
    color: var(--red);
    font-weight: 600;
    font-family: var(--font-mono);
}
.count-warn {
    color: var(--yellow);
    font-weight: 600;
    font-family: var(--font-mono);
}
.count-ok {
    color: var(--text-3);
    font-family: var(--font-mono);
}

/* --- Empty states -------------------------------------------- */
.empty-state {
    text-align: center;
    color: var(--text-3);
    padding: 1.5rem;
    font-style: italic;
}

.empty-state-large {
    text-align: center;
    color: var(--text-3);
    padding: 3rem 1rem;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--r-md);
}

/* --- Section headings ---------------------------------------- */
.admin-page h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-1);
    margin: 1.5rem 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-error {
    color: var(--red) !important;
}
.section-warn {
    color: var(--yellow) !important;
}

/* --- Log Viewer ---------------------------------------------- */
.log-viewer {
    background: var(--navy);
    border-radius: var(--r-md);
    overflow: auto;
    max-height: 70vh;
    margin-bottom: 1.5rem;
}

.log-content {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.55;
    color: #c8d6e5;
    padding: 1rem 1.25rem;
    margin: 0;
    white-space: pre;
    tab-size: 4;
}

.log-error {
    color: #fca5a5;
    background: rgba(220, 38, 38, 0.12);
    display: inline-block;
    width: 100%;
}

.log-warn {
    color: #fde68a;
    background: rgba(217, 119, 6, 0.10);
    display: inline-block;
    width: 100%;
}

/* --- Pipeline Cards ------------------------------------------ */
.admin-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem;
}

.admin-card-label {
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-3);
    margin-bottom: 0.3rem;
}

.admin-card-value {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-1);
}

/* --- Details / Collapsible ----------------------------------- */
.admin-details {
    margin-bottom: 1.5rem;
}

.admin-details summary {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    padding: 0.5rem 0;
}

.admin-details summary:hover {
    color: var(--eth-blue);
}

/* --- Period Selector ----------------------------------------- */
.period-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.period-label {
    font-size: 0.8rem;
    color: var(--text-2);
    margin-right: 0.25rem;
}

.period-btn {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.3rem 0.75rem;
    text-decoration: none;
    transition: all 0.15s;
}

.period-btn:hover {
    background: var(--surface-3);
    color: var(--text-1);
}

.period-active {
    background: var(--eth-blue);
    color: var(--text-inv);
    border-color: var(--eth-blue);
}

.period-active:hover {
    background: var(--eth-blue-dark);
    color: var(--text-inv);
}

/* --- Usage Bar ----------------------------------------------- */
.usage-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 20px;
}

.usage-bar {
    height: 100%;
    min-width: 2px;
    background: var(--eth-blue);
    border-radius: 2px;
    transition: width 0.3s;
}

.usage-pct {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-3);
    white-space: nowrap;
}

/* --- Table alignment ----------------------------------------- */
.col-right {
    text-align: right !important;
}

.total-row td {
    border-top: 2px solid var(--border);
    background: var(--surface-2);
}

/* --- Chart Container ----------------------------------------- */
.chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1rem;
    height: 350px;
    margin-bottom: 1.5rem;
}

/* --- Responsive ---------------------------------------------- */
@media (max-width: 768px) {
    .admin-main {
        padding: 1rem 0.75rem;
    }

    .admin-page-header {
        flex-direction: column;
        gap: 0.3rem;
    }

    .admin-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-info-bar {
        flex-direction: column;
        gap: 0.3rem;
    }
}

@media (max-width: 480px) {
    .admin-cards {
        grid-template-columns: 1fr;
    }
}
