/* ─── Admin Panel Styles — C1 RWA ─────────────────────────── */

:root {
    --teal: #19b8b5;
    --teal-dark: #13918e;
    --ink: #171717;
    --muted: #64605a;
    --border: #ddd7cd;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Source Sans 3", Arial, Helvetica, sans-serif;
    background: #f3f0ea;
    color: var(--ink);
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────── */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 32px;
    min-height: 70px;
    background: #050505;
    border-top: 4px solid var(--teal);
    box-shadow: 0 4px 18px rgba(0,0,0,.28);
    flex-wrap: wrap;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.admin-brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    padding: 3px;
    object-fit: cover;
}

.admin-brand-name {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #ffffff;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-email-badge {
    font-size: .85rem;
    color: #a0a0a0;
    display: none;
}

.admin-logout-btn {
    padding: 7px 18px;
    background: transparent;
    border: 1.5px solid rgba(255,255,255,.3);
    border-radius: 20px;
    color: #ffffff;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .04em;
    transition: border-color .2s, background .2s;
}

.admin-logout-btn:hover {
    border-color: var(--teal);
    background: rgba(25,184,181,.12);
    color: var(--teal);
}

/* ── Page wrapper ────────────────────────────────────────────── */
.admin-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

/* ── Login card ──────────────────────────────────────────────── */
.login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 70px);
    padding: 32px 16px;
}

.login-card {
    width: min(420px, 100%);
    background: #ffffff;
    border: 1.5px solid var(--ink);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(44,36,25,.12);
    overflow: hidden;
}

.login-card-header {
    padding: 20px 28px;
    background: #050505;
    border-bottom: 3px solid var(--teal);
}

.login-card-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: .04em;
}

.login-card-body {
    padding: 28px 28px 32px;
}

.admin-note {
    margin: 0 0 20px;
    padding: 10px 14px;
    background: #f3f0ea;
    border-left: 3px solid var(--teal);
    border-radius: 4px;
    font-size: .82rem;
    color: var(--muted);
    line-height: 1.5;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: .9rem;
    font-weight: 700;
    color: var(--ink);
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: .95rem;
    color: var(--ink);
    background: #fafafa;
    transition: border-color .2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--teal);
    background: #ffffff;
}

.login-error {
    display: block;
    min-height: 20px;
    margin: -8px 0 14px;
    font-size: .85rem;
    color: #e53935;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--ink);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}

.login-btn:hover:not(:disabled) { background: #333; }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Dashboard ───────────────────────────────────────────────── */
.dashboard-section { display: none; }

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
}

.refresh-btn {
    padding: 8px 20px;
    background: var(--ink);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}

.refresh-btn:hover { background: #333; }

/* ── Table card ──────────────────────────────────────────────── */
.table-card {
    background: #ffffff;
    border: 1.5px solid var(--ink);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(44,36,25,.09);
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.complaints-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

.complaints-table thead th {
    padding: 14px 16px;
    background: #050505;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: .05em;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid var(--teal);
}

.complaints-table tbody tr {
    border-bottom: 1px solid #ede9e2;
    transition: background .15s;
}

.complaints-table tbody tr:last-child { border-bottom: none; }
.complaints-table tbody tr:hover { background: #faf8f5; }

.complaints-table td {
    padding: 13px 16px;
    color: var(--ink);
    vertical-align: top;
}

.col-number  { white-space: nowrap; }
.col-name    { min-width: 130px; }
.col-house   { min-width: 100px; }
.col-complaint { min-width: 200px; max-width: 320px; word-break: break-word; }
.col-status  { min-width: 160px; }
.col-date    { white-space: nowrap; min-width: 110px; }
.col-updated { white-space: nowrap; min-width: 110px; color: #64605a; }
.col-resolved { white-space: nowrap; min-width: 110px; font-weight: 700; color: #065f46; }

.complaint-tag {
    display: inline-block;
    padding: 3px 9px;
    background: #050505;
    color: var(--teal);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .06em;
    border-radius: 4px;
    white-space: nowrap;
}

/* Status dropdown */
.status-select {
    width: 100%;
    min-width: 140px;
    padding: 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    color: var(--ink);
    background: #fafafa;
    cursor: pointer;
    transition: border-color .2s;
}

.status-select:focus { outline: none; border-color: var(--teal); }
.status-select:disabled { opacity: .6; cursor: not-allowed; }

/* Status colour coding */
.status-registered   { border-color: #b0b0b0; background: #f5f5f5; }
.status-under-review { border-color: #f59e0b; background: #fffbeb; color: #92400e; }
.status-in-progress  { border-color: #3b82f6; background: #eff6ff; color: #1e40af; }
.status-resolved     { border-color: var(--teal); background: #f0fdfc; color: #065f5c; }
.status-closed       { border-color: #6b7280; background: #f9fafb; color: #374151; }

/* Helper rows */
.loading-row td,
.no-data-row td {
    text-align: center;
    padding: 40px 16px;
    color: var(--muted);
    font-size: .95rem;
}

/* ── Toast notification ──────────────────────────────────────── */
.admin-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 100;
    padding: 13px 22px;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .28s, transform .28s;
    max-width: 340px;
}

.admin-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.admin-toast.success {
    background: #050505;
    color: var(--teal);
    border-left: 4px solid var(--teal);
}

.admin-toast.error {
    background: #fff5f5;
    color: #b91c1c;
    border-left: 4px solid #e53935;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
    .admin-header {
        padding: 12px 16px;
        gap: 12px;
    }

    .admin-page { padding: 24px 14px 48px; }

    .dashboard-header h1 { font-size: 1.25rem; }

    .complaints-table { font-size: .82rem; }

    .complaints-table thead th,
    .complaints-table td { padding: 10px 10px; }

    .admin-toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}
