/* ===================================================================
   style.css — Frenzon SACCO Admin Dashboard
   Plain CSS — no framework dependency.
   =================================================================== */


/* ================================================================
   GLOBAL
   ================================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: #f4f6f8;
    color: #1a1a1a;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.muted {
    color: #888;
}

.error-text {
    color: #c0392b;
    margin-top: 10px;
    font-size: 14px;
    min-height: 18px;
}


/* ================================================================
   LOGIN SCREEN
   ================================================================ */

#loginScreen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #0f1f3d;
}

.login-card {
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.brand-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f1f3d;
}

.brand-subtitle {
    font-size: 14px;
    color: #666;
    margin-top: 3px;
    margin-bottom: 24px;
}

.login-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-top: 16px;
    margin-bottom: 6px;
}

.login-card input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
    color: #1a1a1a;
}

.login-card input:focus {
    outline: none;
    border-color: #0f1f3d;
    box-shadow: 0 0 0 2px rgba(15, 31, 61, 0.08);
}

.login-card button {
    width: 100%;
    margin-top: 24px;
    padding: 12px;
    background: #0f1f3d;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
}

.login-card button:hover {
    background: #16305e;
}

.login-card button:disabled {
    background: #999;
    cursor: not-allowed;
}


/* ================================================================
   DASHBOARD SHELL
   ================================================================ */

#dashboardScreen {
    display: flex;
    min-height: 100vh;
}


/* ================================================================
   SIDEBAR
   ================================================================ */

#sidebar {
    width: 240px;
    min-height: 100vh;

    background: #0f1f3d;
    color: #fff;

    display: flex;
    flex-direction: column;

    padding: 20px 0;

    flex-shrink: 0;
}

.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.brand-title-small {
    font-size: 18px;
    font-weight: 700;
}

.brand-subtitle-small {
    font-size: 12px;
    color: #9fb0c9;
    margin-top: 4px;
}

.nav-list {
    list-style: none;
    flex: 1;
}

.nav-list li {
    margin: 2px 0;
}

.nav-link {
    display: block;

    padding: 12px 20px;

    color: #cfd8e3;
    text-decoration: none;

    font-size: 14px;

    border-left: 3px solid transparent;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-left-color: #4a90d9;
}

.sidebar-footer {
    padding: 0 20px;
}

#logoutButton {
    width: 100%;

    padding: 10px;

    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);

    color: #fff;

    border-radius: 6px;

    font-size: 13px;
}

#logoutButton:hover {
    background: rgba(255, 255, 255, 0.1);
}


/* ================================================================
   MAIN CONTENT
   ================================================================ */

#mainContent {
    flex: 1;

    min-width: 0;

    padding: 30px 40px;

    overflow-y: auto;
}

#pageHeader {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 20px;

    margin-bottom: 24px;
}

#pageTitle {
    font-size: 22px;
    font-weight: 700;
    color: #0f1f3d;
}

#pageSubtitle {
    margin-top: 4px;
    font-size: 13px;
}

#adminUserArea {
    font-size: 13px;
    color: #555;
}


/* ================================================================
   SECTION HEADERS
   ================================================================ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 15px;

    margin: 28px 0 14px;
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f1f3d;
}

.section-description {
    font-size: 13px;
    color: #777;
    margin-top: 3px;
}


/* ================================================================
   DASHBOARD CARDS
   ================================================================ */

.card-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(220px, 1fr));

    gap: 16px;
}

.card {
    background: #fff;

    border-radius: 10px;

    padding: 20px;

    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);

    transition:
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.card.clickable {
    cursor: pointer;
}

.card.clickable:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.card-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
}

.card-value {
    font-size: 26px;
    font-weight: 700;
    color: #0f1f3d;
}

.card-subtext {
    margin-top: 6px;
    font-size: 12px;
    color: #888;
}


/* ================================================================
   STAT / SUMMARY GRID
   ================================================================ */

.summary-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));

    gap: 14px;
}


/* ================================================================
   TABLE CONTAINER
   ================================================================ */

.table-container {
    width: 100%;

    background: #fff;

    border-radius: 10px;

    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);

    overflow-x: auto;
}


/* ================================================================
   TABLES
   ================================================================ */

table {
    width: 100%;

    border-collapse: collapse;

    background: #fff;
}

th,
td {
    text-align: left;

    padding: 11px 14px;

    font-size: 14px;

    border-bottom: 1px solid #eee;

    white-space: nowrap;
}

th {
    background: #f0f2f5;

    font-weight: 600;

    color: #444;
}

tbody tr:hover td {
    background: #fafbfc;
}

tbody tr:last-child td {
    border-bottom: none;
}


/* ================================================================
   STATUS BADGES
   ================================================================ */

.status-badge {
    display: inline-flex;

    align-items: center;

    padding: 4px 9px;

    border-radius: 999px;

    font-size: 12px;

    font-weight: 600;

    background: #eef1f5;

    color: #555;
}

.status-pending {
    background: #fff4d6;
    color: #8a6500;
}

.status-approved {
    background: #e5f4ea;
    color: #21733d;
}

.status-posted {
    background: #e4f0ff;
    color: #245b9e;
}

.status-rejected {
    background: #fde9e7;
    color: #a93226;
}

.status-cancelled,
.status-reversed {
    background: #eeeeee;
    color: #666;
}


/* ================================================================
   BUTTONS
   ================================================================ */

.button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 9px 14px;

    border-radius: 6px;

    border: 1px solid transparent;

    font-size: 13px;

    font-weight: 600;

    cursor: pointer;
}

.button-primary {
    background: #0f1f3d;
    color: #fff;
}

.button-primary:hover {
    background: #16305e;
}

.button-secondary {
    background: #fff;
    color: #0f1f3d;
    border-color: #ccd3dc;
}

.button-secondary:hover {
    background: #f5f7f9;
}

.button-danger {
    background: #c0392b;
    color: #fff;
}

.button-danger:hover {
    background: #a93226;
}

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


/* ================================================================
   FILTERS / SEARCH
   ================================================================ */

.filter-bar {
    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    margin-bottom: 16px;
}

.filter-bar input,
.filter-bar select {
    min-width: 180px;

    padding: 9px 11px;

    border: 1px solid #ccd3dc;

    border-radius: 6px;

    background: #fff;

    font-size: 13px;
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;

    border-color: #0f1f3d;

    box-shadow: 0 0 0 2px rgba(15, 31, 61, 0.08);
}


/* ================================================================
   EMPTY / LOADING / ERROR STATES
   ================================================================ */

.loading-state,
.empty-state,
.error-state {
    background: #fff;

    border-radius: 10px;

    padding: 30px;

    text-align: center;

    font-size: 14px;
}

.loading-state {
    color: #777;
}

.empty-state {
    color: #777;
}

.error-state {
    color: #c0392b;
}


/* ================================================================
   TASKS & FOLLOW-UPS PAGE
   Uses the shared .card, .button, .status-badge, .section-* and
   *-state classes above. Only task-specific layout lives here.
   ================================================================ */

.task-panel {
    display: grid;
    gap: 24px;
    width: 100%;
}

.task-panel .section-header {
    margin: 0 0 12px;
}

/* Status / feedback banner (hidden while empty) */

.task-message {
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 14px;
    background: #eef1f5;
    color: #444;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.task-message:empty {
    display: none;
}

.task-message.is-success {
    background: #e5f4ea;
    color: #21733d;
}

.task-message.is-error {
    background: #fde9e7;
    color: #a93226;
}

/* Overview cards */

.task-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.task-summary-grid .loading-state {
    grid-column: 1 / -1;
}

.task-stat {
    padding: 14px 16px;
}

.task-stat .card-label {
    margin-bottom: 4px;
    font-size: 12px;
}

.task-stat .card-value {
    font-size: 24px;
}

.task-stat-alert .card-value {
    color: #c0392b;
}

/* Create form and filters */

.task-form-card {
    padding: 20px;
}

.task-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.task-field {
    min-width: 0;
}

.task-field-wide {
    grid-column: 1 / -1;
}

.task-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.task-field input,
.task-field select,
.task-field textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ccd3dc;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
    font-size: 14px;
}

.task-field input:focus,
.task-field select:focus,
.task-field textarea:focus {
    outline: none;
    border-color: #0f1f3d;
    box-shadow: 0 0 0 2px rgba(15, 31, 61, 0.08);
}

.task-field input:disabled {
    background: #f0f2f5;
    color: #666;
    cursor: not-allowed;
}

.task-field textarea {
    min-height: 90px;
    resize: vertical;
}

.task-hint {
    margin-top: 5px;
    font-size: 12px;
    color: #888;
}

.task-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.task-form-actions .task-hint {
    margin-top: 0;
}

.task-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

/* Task list */

.task-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.task-card {
    padding: 16px 18px;
    border-left: 4px solid #ccd3dc;
}

.task-status-pending {
    border-left-color: #e0a800;
}

.task-status-in_progress {
    border-left-color: #4a90d9;
}

.task-status-completed {
    border-left-color: #21733d;
}

.task-status-cancelled {
    border-left-color: #999;
}

.task-card.is-overdue {
    border-left-color: #c0392b;
}

.task-card-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.task-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f1f3d;
    overflow-wrap: anywhere;
}

.task-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.priority-urgent {
    background: #fde9e7;
    color: #a93226;
}

.priority-high {
    background: #ffe9d6;
    color: #9a4b00;
}

.task-description {
    margin-top: 10px;
    font-size: 14px;
    color: #444;
    overflow-wrap: anywhere;
}

.task-details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
    margin-top: 12px;
}

.task-details dt {
    font-size: 13px;
    color: #888;
}

.task-details dd {
    font-size: 14px;
    overflow-wrap: anywhere;
}

.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}


/* ================================================================
   RESPONSIVE — TABLET
   ================================================================ */

@media (max-width: 900px) {

    #sidebar {
        width: 200px;
    }

    #mainContent {
        padding: 24px;
    }

    .card-grid {
        grid-template-columns:
            repeat(auto-fill, minmax(190px, 1fr));
    }
}


/* ================================================================
   RESPONSIVE — MOBILE
   ================================================================ */

@media (max-width: 700px) {

    #dashboardScreen {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        min-height: auto;

        padding: 12px 0;
    }

    .sidebar-brand {
        padding: 0 16px 12px;
        margin-bottom: 6px;
    }

    .nav-list {
        display: flex;

        overflow-x: auto;

        padding: 0 8px;

        gap: 2px;
    }

    .nav-list li {
        flex-shrink: 0;
    }

    .nav-link {
        padding: 9px 12px;

        border-left: none;
        border-bottom: 3px solid transparent;

        border-radius: 4px 4px 0 0;
    }

    .nav-link.active {
        border-left-color: transparent;
        border-bottom-color: #4a90d9;
    }

    .sidebar-footer {
        padding: 10px 16px 0;
    }

    #logoutButton {
        max-width: 160px;
    }

    #mainContent {
        padding: 20px 16px;
    }

    #pageHeader {
        flex-direction: column;

        margin-bottom: 20px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .login-card {
        padding: 30px 24px;
    }

    /* Tasks page */

    .task-form-card {
        padding: 16px;
    }

    .task-form-grid {
        grid-template-columns: 1fr;
    }

    /* 16px stops iOS from zooming into fields on focus */
    .task-field input,
    .task-field select,
    .task-field textarea {
        font-size: 16px;
    }

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

    .task-form-actions .button,
    .task-filter-actions .button {
        flex: 1 1 100%;
    }

    .task-filter-actions .button {
        flex: 1 1 0;
    }

    .task-details {
        grid-template-columns: 96px 1fr;
        gap: 6px 12px;
    }

    .task-actions .button {
        flex: 1 1 0;
        min-width: 100px;
    }
}


/* ================================================================
   ACCESSIBILITY / REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
