/* ==========================================================================
   WizBrand Dashboard — shared theme for the logged-in / admin pages.
   Loaded once on every orgs-page-layout page (same CSS on all dashboard pages).
   STYLING ONLY — no markup ids, JS hooks, DataTables config or functionality
   are changed by this file. Matches the new public-site navy/blue theme.
   ========================================================================== */

/* ---- Page shell --------------------------------------------------------- */
.wz-dash {
    background: #f4f7fc;
}

/* ---- Card container ----------------------------------------------------- */
.pro-org-container,
.wz-card {
    background: #fff;
    border: 1px solid #e6ecf5 !important;
    border-radius: 18px !important;
    box-shadow: 0 18px 50px rgba(15, 27, 52, .08) !important;
}

/* ---- Page header (title + actions) -------------------------------------- */
.wz-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
}

.wz-page-title {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    font-weight: 800;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    letter-spacing: -.02em;
    color: #0f1b34;
}

.wz-page-sub {
    margin: .25rem 0 0;
    color: #6b7894;
    font-size: .97rem;
}

.wz-head-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

/* ---- Buttons ------------------------------------------------------------ */
.wz-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.2rem;
    font-size: .95rem;
    font-weight: 700;
    border-radius: 11px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: transform .18s, background .18s, color .18s, box-shadow .18s;
}

.wz-btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.wz-btn-ghost {
    background: #fff;
    color: #1d4ed8 !important;
    border-color: #d8e4ff;
}

.wz-btn-ghost:hover {
    background: #f3f7ff;
    color: #1741b6 !important;
}

/* "Add Organization" — keeps #create_org_record id & .add-org-link class */
.add-org-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: #1d4ed8 !important;
    color: #fff !important;
    border: none;
    border-radius: 11px;
    font-weight: 700 !important;
    font-size: .95rem !important;
    padding: .6rem 1.2rem !important;
    margin-left: 0 !important;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(29, 78, 216, .28);
    transition: transform .18s, background .18s, box-shadow .18s;
}

.add-org-link:hover,
.add-org-link:focus {
    background: #1741b6 !important;
    color: #fff !important;
    text-decoration: none !important;
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(29, 78, 216, .34);
}

/* ---- Table wrapper ------------------------------------------------------ */
.org-data-table-wrap {
    background: #fff;
    border-radius: 16px;
    padding: .4rem 0;
    overflow-x: auto;
}

/* Desktop: the table fits (fixed layout + autoWidth:false), so no stray
   horizontal scrollbar. Mobile keeps overflow-x:auto for scrolling. */
@media (min-width: 993px) {
    .org-data-table-wrap {
        overflow-x: hidden;
    }
}

/* ---- DataTables controls (length + search) ------------------------------ */
.dataTables_length label,
.dataTables_filter label {
    margin-bottom: 0;
    font-weight: 600;
    color: #41506b;
}

.dataTables_filter input[type=search] {
    min-width: 210px;
    margin-left: .5rem;
    padding: .5rem .9rem;
    font-size: .95rem;
    color: #0f1b34;
    background: #fff;
    border: 1.5px solid #e0e8f5;
    border-radius: 11px;
    transition: border-color .2s, box-shadow .2s;
}

.dataTables_filter input[type=search]:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}

.dataTables_length select {
    padding: .4rem 1.6rem .4rem .7rem;
    font-size: .95rem;
    color: #0f1b34;
    background: #fff;
    border: 1.5px solid #e0e8f5;
    border-radius: 9px;
}

.dataTables_length select:focus {
    outline: none;
    border-color: #1d4ed8;
}

/* ---- Table -------------------------------------------------------------- */
.org-data-table {
    border-collapse: separate;
    border-spacing: 0;
    /* Fixed layout makes columns honour their % widths instead of growing to fit
       long content (e.g. emails) — so the table never exceeds its container and
       no stray horizontal scrollbar appears on desktop. */
    table-layout: fixed;
    width: 100%;
}

.org-data-table th,
.org-data-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.org-data-table thead th {
    background: #0b2350;
    color: #fff;
    font-weight: 700;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border: none;
    padding: .95rem .9rem;
    vertical-align: middle;
}

.org-data-table thead th:first-child {
    border-top-left-radius: 12px;
}

.org-data-table thead th:last-child {
    border-top-right-radius: 12px;
}

.org-data-table tbody td {
    padding: .85rem .9rem;
    font-size: .97rem;
    color: #41506b;
    border: none;
    border-bottom: 1px solid #eef2f8;
    vertical-align: middle;
}

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

.org-data-table tbody tr:last-child td {
    border-bottom: none;
}

/* DataTables sort arrows */
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after,
table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before {
    color: #9fb6e6;
    opacity: .9;
}

/* ---- Row action buttons (rendered by JS, keep classes) ------------------ */
.org-data-table .btn-outline-primary {
    color: #1d4ed8;
    border-color: #cdddfb;
}

.org-data-table .btn-outline-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.org-data-table .btn-outline-secondary {
    color: #41506b;
    border-color: #dbe2ee;
}

.org-data-table .btn-outline-secondary:hover {
    background: #41506b;
    border-color: #41506b;
    color: #fff;
}

.org-data-table .btn-outline-danger {
    color: #dc3545;
    border-color: #f3c2c8;
}

.org-data-table .btn-outline-danger:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

/* ---- Pagination (DataTables Bootstrap-4 markup) ------------------------- */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
}

.dataTables_wrapper .pagination .page-link {
    margin: 0 3px;
    padding: .45rem .85rem;
    font-weight: 600;
    color: #41506b;
    background: #fff;
    border: 1px solid #e0e8f5;
    border-radius: 9px;
    transition: all .15s;
}

.dataTables_wrapper .pagination .page-link:hover {
    background: #f3f7ff;
    border-color: #1d4ed8;
    color: #1d4ed8;
}

.dataTables_wrapper .pagination .page-item.active .page-link {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
    box-shadow: 0 8px 18px rgba(29, 78, 216, .28);
}

.dataTables_wrapper .pagination .page-item.disabled .page-link {
    background: #fff;
    border-color: #eef2f8;
    color: #aeb8c9;
}

.dataTables_wrapper .dataTables_info {
    padding-top: 1rem;
    color: #6b7894;
}

/* ---- Modals — light polish (keeps bg-primary header working) ------------ */
.modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(15, 27, 52, .25);
}

.modal-header.bg-primary {
    background: linear-gradient(120deg, #0b2350, #1d4ed8) !important;
    border: none;
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 800px) {

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        width: 100%;
        float: none !important;
        text-align: left !important;
        margin-bottom: .7rem;
    }

    /* Keep "Show 10 entries" on one inline line */
    .dataTables_length label {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        white-space: nowrap;
    }

    .dataTables_length label select {
        margin: 0 .2rem;
        width: auto;
        display: inline-block;
    }

    /* Search: full-width input on its own line */
    .dataTables_filter label {
        display: block;
        width: 100%;
    }

    .dataTables_filter input[type=search] {
        display: block;
        width: 100%;
        min-width: 0;
        margin: .35rem 0 0;
    }

    .wz-page-head {
        gap: .7rem;
    }

    .wz-head-actions {
        width: 100%;
    }

    .org-data-table-wrap {
        -webkit-overflow-scrolling: touch;
    }

    /* Only force a min width on WIDE scrolling tables (the 7-column management
       dashboard, which uses DataTables scrollX). The simple public listing
       (3 columns) fits the screen and must NOT overflow the card. */
    .dataTables_scrollBody .org-data-table {
        min-width: 640px;
    }

    /* the 7-column management table scrolls CLEANLY on phones — content-sized
       columns with one-line headers/emails (no cramming or overlap). The public
       listing (.org-listing) becomes stacked cards instead, so it is excluded. */
    .org-data-table:not(.org-listing) {
        table-layout: auto;
        min-width: 100%;
    }

    .org-data-table:not(.org-listing) th,
    .org-data-table:not(.org-listing) td {
        white-space: nowrap;
        overflow-wrap: normal;
        word-break: normal;
    }
}

/* ---- Public listing (.org-listing) → stacked cards on phones ------------- */
/* Each row becomes a clean "Label: value" card — no cramped columns, no ugly
   date wrapping, no horizontal scroll. Only affects the public listing table. */
@media (max-width: 640px) {
    .org-listing thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    .org-listing,
    .org-listing tbody,
    .org-listing tr,
    .org-listing td {
        display: block;
        width: 100%;
    }

    .org-listing tr {
        margin-bottom: 14px;
        padding: 4px 16px;
        border: 1px solid #e6ecf5;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 6px 18px rgba(15, 27, 52, .06);
    }

    .org-listing tbody tr:hover {
        background: #fff;
    }

    .org-listing td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 11px 0 !important;
        border: none !important;
        border-bottom: 1px solid #f0f4fa !important;
        text-align: right;
        white-space: normal;
        color: #334155;
    }

    .org-listing tr td:last-child {
        border-bottom: none !important;
    }

    .org-listing td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-weight: 700;
        color: #0b2350;
        text-align: left;
    }
}

/* ---- Notification dropdown (top-bar bell) ------------------------------- */
.noti-menu {
    width: 360px;
    max-width: 92vw;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
}

.noti-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    font-size: 1rem;
    font-weight: 700;
    color: #0b2350;
    border-bottom: 1px solid #eef2f8;
}

.noti-badge-pill {
    font-size: .72rem;
    font-weight: 700;
    color: #fff;
    background: #f26252;
    padding: 3px 10px;
    border-radius: 999px;
}

.noti-scroll {
    display: block;
    max-height: 340px;
    overflow-y: auto;
}

.noti-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 18px;
    text-decoration: none;
    border-bottom: 1px solid #f4f7fb;
    transition: background .15s;
}

.noti-item:hover {
    background: #f3f7ff;
    text-decoration: none;
}

.noti-ic {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1rem;
}

.noti-ic--org {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.noti-ic--task {
    background: linear-gradient(135deg, #06b6d4, #0e7490);
}

.noti-ic--inf {
    background: linear-gradient(135deg, #34d399, #059669);
}

.noti-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.noti-text {
    font-size: .9rem;
    line-height: 1.35;
    color: #334155;
}

.noti-text b {
    color: #0b2350;
}

.noti-time {
    font-size: .76rem;
    color: #94a3b8;
}

.noti-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 30px 18px;
    color: #94a3b8;
    font-size: .92rem;
}

.noti-empty i {
    font-size: 1.8rem;
    color: #cbd5e1;
}

.noti-foot {
    padding: 0;
    border-top: 1px solid #eef2f8;
}

.noti-foot a {
    display: block;
    padding: 12px;
    text-align: center;
    font-size: .9rem;
    font-weight: 700;
    color: #1d4ed8;
    text-decoration: none;
}

.noti-foot a:hover {
    background: #f3f7ff;
    color: #1741b6;
}

/* ---- All Notifications page --------------------------------------------- */
.wz-noti-page {
    background: #f4f7fc;
    min-height: 70vh;
    padding: clamp(28px, 5vw, 56px) 0;
}

.wz-noti-head {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 820px;
    margin: 0 auto 26px;
    padding: 0 18px;
}

.wz-noti-head .ic {
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #0b2350, #1d4ed8);
    box-shadow: 0 10px 24px rgba(29, 78, 216, .3);
}

.wz-noti-head h1 {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    color: #0f1b34;
}

.wz-noti-head p {
    margin: 2px 0 0;
    color: #6b7894;
    font-size: .95rem;
}

.wz-noti-list {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wz-noti-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #e6ecf5;
    border-left: 4px solid #1d4ed8;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(15, 27, 52, .06);
    transition: transform .2s, box-shadow .2s;
}

.wz-noti-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(15, 27, 52, .12);
}

.wz-noti-card.t-org {
    border-left-color: #1d4ed8;
}

.wz-noti-card.t-task {
    border-left-color: #0e7490;
}

.wz-noti-card.t-inf {
    border-left-color: #059669;
}

.wz-noti-card .n-ic {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.2rem;
}

.wz-noti-card.t-org .n-ic {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.wz-noti-card.t-task .n-ic {
    background: linear-gradient(135deg, #06b6d4, #0e7490);
}

.wz-noti-card.t-inf .n-ic {
    background: linear-gradient(135deg, #34d399, #059669);
}

.wz-noti-card .n-body {
    flex: 1 1 auto;
    min-width: 0;
}

.wz-noti-card .n-body p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    color: #334155;
}

.wz-noti-card .n-body b {
    color: #0b2350;
}

.wz-noti-card .n-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: .8rem;
    color: #94a3b8;
}

.wz-noti-card .n-read {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: .85rem;
    font-weight: 700;
    color: #1d4ed8;
    background: #eef4ff;
    border: 1px solid #d8e4ff;
    border-radius: 9px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}

.wz-noti-card .n-read:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.wz-noti-empty {
    max-width: 820px;
    margin: 0 auto;
    padding: 60px 18px;
    text-align: center;
    color: #94a3b8;
}

.wz-noti-empty i {
    font-size: 3rem;
    color: #cbd5e1;
}

.wz-noti-empty p {
    margin: 14px 0 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #64748b;
}

@media (max-width: 600px) {
    .wz-noti-page {
        padding: 22px 0 40px;
    }

    .wz-noti-head {
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .wz-noti-head .ic {
        width: 44px;
        height: 44px;
        font-size: 1.15rem;
        border-radius: 13px;
    }

    .wz-noti-head h1 {
        font-size: 1.35rem;
    }

    .wz-noti-head p {
        font-size: .85rem;
    }

    .wz-noti-list {
        padding: 0 14px;
        gap: 12px;
    }

    .wz-noti-card {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }

    .wz-noti-card .n-ic {
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }

    .wz-noti-card .n-body {
        flex: 1 1 0;
        min-width: 0;
    }

    .wz-noti-card .n-body p {
        font-size: .95rem;
    }

    .wz-noti-card .n-read {
        width: 100%;
        justify-content: center;
        margin-top: 2px;
        padding: 11px;
    }
}

/* Notification bell dropdown — keep within the screen on small devices */
@media (max-width: 480px) {
    .noti-menu {
        width: 94vw;
        max-width: 94vw;
    }
}

/* ---- Navbar dropdowns (user menu + notifications) — enterprise polish ---- */
.mdc-top-app-bar .dropdown-menu,
.dropdown-menu.dropdown-menu-end {
    border: 1px solid #e6ecf5;
    border-radius: 14px;
    box-shadow: 0 20px 48px rgba(15, 27, 52, .18);
    padding: 8px;
    margin-top: 12px;
    overflow: hidden;
}

.dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .62rem .8rem;
    border-radius: 9px;
    font-weight: 500;
    font-size: .95rem;
    color: #41506b;
    transition: background .15s, color .15s;
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    background: #eef4ff;
    color: #1d4ed8;
}

.dropdown-menu .dropdown-item.text-danger:hover {
    background: #fdecec;
    color: #dc3545;
}

.dropdown-menu .dropdown-divider {
    border-top-color: #eef2f8;
    margin: .35rem .2rem;
}

.dropdown-menu .badge.bg-success {
    border-radius: 999px;
    padding: .25em .6em;
}

/* ---- Row action buttons polish ------------------------------------------ */
.org-data-table .btn-sm {
    border-radius: 9px;
    min-width: 36px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.org-data-table .btn-sm + .btn-sm {
    margin-left: 6px;
}
