/* PhushaDonsa Admin — minimal functional styles */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #f5f5f5;
    color: #222;
}

/* ── Admin layout ── */

.admin-container {
    display: flex;
    min-height: 100vh;
}

.admin-nav {
    width: 220px;
    background: #1a1a2e;
    color: #eee;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-nav h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ccc;
}

.admin-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-nav ul li a {
    display: block;
    padding: 0.5rem 0.25rem;
    color: #ccc;
    text-decoration: none;
}

.admin-nav ul li a:hover {
    color: #fff;
}

.admin-nav form {
    margin-top: auto;
}

.admin-nav form button {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid #555;
    color: #ccc;
    cursor: pointer;
    border-radius: 4px;
}

.admin-nav form button:hover {
    background: #333;
}

.admin-content {
    flex: 1;
    padding: 2rem;
}

/* ── Login page ── */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f5f5f5;
}

.login-container h1 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.login-container form {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-container form div {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.login-container form label {
    font-size: 0.875rem;
    font-weight: 600;
}

.login-container form input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.login-container form button {
    padding: 0.625rem;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

.login-container form button:hover {
    background: #2a2a4e;
}

.login-error {
    color: #c0392b;
    background: #fdecea;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* ── Filter form ── */

.filter-form {
    background: #fff;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-row label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.filter-row input,
.filter-row select {
    padding: 0.4rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}

.filter-row button {
    padding: 0.4rem 1rem;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    height: fit-content;
}

.filter-row button:hover {
    background: #2a2a4e;
}

.filter-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Data table ── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.data-table th {
    background: #f0f0f0;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
}

.data-table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border-top: 1px solid #eee;
}

.data-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.data-table tbody tr:hover {
    background: #f0f4ff;
}

/* ── Outcome badges ── */

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-green {
    background: #d4edda;
    color: #155724;
}

.badge-amber {
    background: #fff3cd;
    color: #856404;
}

.badge-red {
    background: #f8d7da;
    color: #721c24;
}

/* ── Pagination ── */

.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
}

.pagination button {
    padding: 0.4rem 1rem;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.pagination button:hover:not(:disabled) {
    background: #2a2a4e;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination span {
    font-size: 0.9rem;
    color: #555;
}

/* ── Notes and empty state ── */

.timestamp-note {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.filter-note {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.empty-state {
    color: #777;
    padding: 2rem;
    text-align: center;
    background: #fff;
    border-radius: 6px;
}

/* ── Error banner ── */

.error-banner {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.error-banner button {
    padding: 0.3rem 0.75rem;
    background: #721c24;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* ── Reconciliation page ── */

.row-divergent {
    background: #fff5f5 !important;
    border-left: 3px solid #c0392b;
}

.row-ok {
    /* intentionally unstyled — default table row */
}

.badge-match {
    background: #d4edda;
    color: #155724;
}

.badge-mismatch {
    background: #f8d7da;
    color: #721c24;
}

.summary-row td {
    border-top: 2px solid #ccc;
    background: #f0f0f0;
}

.summary-row.divergent td {
    background: #fff5f5;
    border-left: 3px solid #c0392b;
}

.drill-down-link {
    display: block;
    font-size: 0.82rem;
    color: #c0392b;
    text-decoration: none;
    margin-bottom: 0.2rem;
}

.drill-down-link:hover {
    text-decoration: underline;
}

.reconciliation-note {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    margin-top: 0.5rem;
}

/* ── Payload preview ── */

.payload-preview {
    font-family: monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

.show-more-btn {
    background: none;
    border: none;
    color: #1a73e8;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0;
    margin-left: 0.5rem;
    text-decoration: underline;
}

/* ── Modal ── */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    max-width: 700px;
    max-height: 80vh;
    overflow: auto;
    width: 90%;
}

.modal-content pre {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
}

.modal-content button {
    margin-top: 1rem;
    padding: 0.4rem 1rem;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* ── Site config page ── */

.config-form {
    background: #fff;
    padding: 1.5rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
}

.config-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.config-field label {
    font-size: 0.875rem;
    font-weight: 600;
}

.config-field input,
.config-field select {
    padding: 0.4rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    max-width: 400px;
}

.config-field .field-hint {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

.config-field .field-error {
    font-size: 0.8rem;
    color: #c0392b;
}

.config-field.field-conflict {
    background: #fff8e1;
    border-left: 3px solid #f39c12;
    padding-left: 0.5rem;
    border-radius: 2px;
}

.price-preview {
    font-size: 0.9rem;
    color: #555;
    font-weight: 600;
}

.config-version-info {
    background: #f0f0f0;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.save-btn {
    padding: 0.5rem 1.5rem;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.save-btn:hover:not(:disabled) {
    background: #2a2a4e;
}

.save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.divergence-section {
    margin-top: 1.5rem;
}

.divergence-section h3 {
    margin-bottom: 0.5rem;
}

.divergence-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    font-size: 0.85rem;
}

.divergence-ok {
    background: #d4edda;
    color: #155724;
    font-size: 0.85rem;
}

/* ── Dashboard fleet summary (Story 8.2) ── */

.fleet-summary { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.metric-card { background: #fff; padding: 1rem 1.5rem; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); text-align: center; min-width: 120px; }
.metric-card .metric-value { font-size: 2rem; font-weight: 700; }
.metric-card .metric-label { font-size: 0.8rem; color: #555; text-transform: uppercase; letter-spacing: 0.04em; }
.metric-card.metric-green .metric-value { color: #155724; }
.metric-card.metric-amber .metric-value { color: #856404; }
.metric-card.metric-red .metric-value { color: #721c24; }
.badge-gray { background: #e2e3e5; color: #383d41; }
.badge-sd-suspect { background: #f8d7da; color: #721c24; font-weight: 700; }
.refresh-bar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; font-size: 0.85rem; color: #888; }
.refresh-bar button { padding: 0.4rem 1rem; background: #1a1a2e; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 0.9rem; }
.refresh-bar button:hover:not(:disabled) { background: #2a2a4e; }
.refresh-bar button:disabled { opacity: 0.5; cursor: not-allowed; }
.dashboard-table-wrap { overflow-x: auto; }
.staleness-banner { background: #fff3cd; color: #856404; border: 1px solid #ffc107; padding: 0.5rem 0.75rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.85rem; }

/* ── Maintenance & Alerts page (Story 8.6) ── */
.maintenance-table { width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 1.5rem; }
.maintenance-table th { background: #f0f0f0; padding: 0.6rem 0.75rem; text-align: left;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: #555; }
.maintenance-table td { padding: 0.5rem 0.75rem; font-size: 0.9rem; border-top: 1px solid #eee; }
.maintenance-active { color: #856404; font-weight: 600; }
.maintenance-inactive { color: #777; }
.duration-select { padding: 0.3rem 0.5rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.85rem; }
.maintenance-btn { padding: 0.3rem 0.75rem; border: none; border-radius: 4px; cursor: pointer;
  font-size: 0.85rem; }
.maintenance-btn-enable { background: #1a1a2e; color: #fff; }
.maintenance-btn-enable:hover:not(:disabled) { background: #2a2a4e; }
.maintenance-btn-disable { background: #856404; color: #fff; }
.maintenance-btn-disable:hover:not(:disabled) { background: #6d4e00; }
.maintenance-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.alert-email-input { padding: 0.35rem 0.5rem; border: 1px solid #ccc; border-radius: 4px;
  font-size: 0.85rem; min-width: 280px; }
.alert-email-error { color: #c0392b; font-size: 0.8rem; display: block; margin-top: 0.2rem; }
.alert-section-note { font-size: 0.85rem; color: #555; margin-bottom: 0.75rem; }
