/* ═══════════════════════════════════════════════════════════════
   site.css  —  NIKHAN CONTROLS ERP  —  Shared styles
   Used by: AdminDashboard, ProductionPlan, Department, Login
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── CSS Variables ── */
:root {
    --navy-900: #0f172a;
    --navy-700: #1e3a8a;
    --blue: #2563eb;
    --blue-lt: #3b82f6;
    --sky: #38bdf8;
    --white: #ffffff;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,.18);
    --shadow-sm: 0 2px 8px rgba(0,0,0,.10);
}

/* ── Base ── */
body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--slate-100);
    color: var(--slate-700);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── App shell ── */
.app {
    display: flex;
    min-height: 100vh;
}

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 100%);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

    .sidebar::before {
        content: '';
        position: absolute;
        width: 320px;
        height: 320px;
        background: rgba(255,255,255,.045);
        border-radius: 50%;
        top: -120px;
        right: -120px;
        pointer-events: none;
    }

    .sidebar::after {
        content: '';
        position: absolute;
        width: 220px;
        height: 220px;
        background: rgba(255,255,255,.035);
        border-radius: 50%;
        bottom: -80px;
        left: -80px;
        pointer-events: none;
    }

.sidebar-head {
    padding: 28px 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    position: relative;
    z-index: 2;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,.12);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-brand h2 {
    color: var(--white);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .5px;
}

.sidebar-context {
    font-size: 12px;
    color: var(--slate-300);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding-left: 52px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
    position: relative;
    z-index: 2;
}

    .sidebar-nav::-webkit-scrollbar {
        width: 4px;
    }

    .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.15);
        border-radius: 4px;
    }

.nav-group-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--slate-400);
    padding: 14px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: none;
    background: transparent;
    color: var(--slate-300);
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s;
    text-align: left;
    position: relative;
}

    .nav-link:hover {
        background: rgba(255,255,255,.08);
        color: var(--white);
        transform: translateX(3px);
    }

    .nav-link.active {
        background: rgba(37,99,235,.45);
        color: var(--white);
        box-shadow: 0 2px 12px rgba(37,99,235,.3);
    }

        .nav-link.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 60%;
            background: var(--sky);
            border-radius: 0 3px 3px 0;
        }

.nav-icon {
    font-size: 16px;
}

.sidebar-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    position: relative;
    z-index: 2;
}

.user-pip {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--blue), var(--sky));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
}

.user-name {
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
}

.user-dept {
    color: var(--slate-400);
    font-size: 11px;
}

.logout-btn {
    background: rgba(255,255,255,.08);
    border: none;
    color: var(--slate-300);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: all .2s;
}

    .logout-btn:hover {
        background: rgba(239,68,68,.25);
        color: #fca5a5;
    }

/* ════════════════════════════════════════
   MAIN / TOPBAR
════════════════════════════════════════ */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--navy-900);
    letter-spacing: .3px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-date {
    font-size: 13px;
    color: var(--slate-500);
    background: var(--slate-100);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--slate-200);
}

.topbar-divider {
    width: 1px;
    height: 32px;
    background: var(--slate-200);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 8px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 40px;
    cursor: default;
    transition: background .2s;
}

    .topbar-user:hover {
        background: var(--slate-100);
    }

.topbar-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--blue), var(--sky));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.topbar-user-info {
    line-height: 1.25;
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy-900);
}

.topbar-user-role {
    font-size: 11px;
    color: var(--slate-500);
    font-weight: 500;
}

.topbar-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1.5px solid var(--slate-200);
    border-radius: 9px;
    color: var(--slate-600);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

    .topbar-logout:hover {
        background: rgba(239,68,68,.08);
        border-color: rgba(239,68,68,.3);
        color: var(--red);
    }

/* ════════════════════════════════════════
   PAGE
════════════════════════════════════════ */
.page {
    padding: 24px 28px;
}

/* ── Cards ── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(90deg, var(--navy-900) 0%, var(--navy-700) 100%);
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* ── Filter bar ── */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.fgrp {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.frow-4, .frow-3, .frow-2 {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}

.frow-4 {
    grid-template-columns: repeat(4, 1fr);
}

.frow-3 {
    grid-template-columns: repeat(3, 1fr);
}

.frow-2 {
    grid-template-columns: repeat(2, 1fr);
}

.flbl {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--slate-500);
}

.fselect, .finput {
    border: 1.5px solid var(--slate-200);
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--slate-700);
    background: var(--white);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
}

    .fselect:focus, .finput:focus {
        border-color: var(--blue);
        box-shadow: 0 0 0 3px rgba(37,99,235,.1);
    }

    .finput:disabled {
        background: var(--slate-50);
        color: var(--slate-400);
        cursor: not-allowed;
        border-style: dashed;
    }

input[type="date"].finput {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    color-scheme: light;
    cursor: pointer;
    min-width: 140px;
}

    input[type="date"].finput::-webkit-calendar-picker-indicator {
        cursor: pointer;
        opacity: .8;
        filter: invert(28%) sepia(90%) saturate(400%) hue-rotate(200deg) brightness(95%);
    }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 9px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary, .btn-teal {
    background: linear-gradient(135deg, var(--navy-700), var(--blue));
    color: white;
}

    .btn-primary:hover, .btn-teal:hover {
        opacity: .88;
        transform: translateY(-1px);
        box-shadow: 0 4px 14px rgba(37,99,235,.35);
        color: white;
    }

.btn-amber {
    background: linear-gradient(135deg, var(--blue), var(--sky));
    color: white;
}

    .btn-amber:hover {
        opacity: .88;
        transform: translateY(-1px);
        box-shadow: 0 4px 14px rgba(56,189,248,.35);
    }

.btn-ghost {
    background: var(--slate-100);
    color: var(--slate-700);
    border: 1px solid var(--slate-200);
}

    .btn-ghost:hover {
        background: var(--slate-200);
    }

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
}

.badge-slate {
    background: var(--slate-100);
    color: var(--slate-600);
}

.badge-blue {
    background: rgba(37,99,235,.12);
    color: var(--blue);
}

.badge-green {
    background: rgba(16,185,129,.12);
    color: var(--green);
}

.badge-amber {
    background: rgba(245,158,11,.12);
    color: var(--amber);
}

.badge-red {
    background: rgba(239,68,68,.12);
    color: var(--red);
}

/* ── Alerts ── */
.alert {
    border-radius: 9px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
}

    .alert:empty {
        display: none;
    }

.alert-error {
    background: rgba(239,68,68,.1);
    color: #b91c1c;
    border: 1px solid rgba(239,68,68,.2);
}

.alert-success {
    background: rgba(16,185,129,.1);
    color: #065f46;
    border: 1px solid rgba(16,185,129,.2);
}

/* ── Collapse section (Add/Edit form) ── */
.add-plan-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.add-plan-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(90deg, var(--navy-900) 0%, var(--navy-700) 100%);
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
}

    .add-plan-toggle:hover {
        opacity: .92;
    }

.add-plan-toggle-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: .3px;
}

.add-plan-toggle-sub {
    font-size: 12px;
    color: var(--slate-300);
    margin-top: 2px;
}

.add-plan-chevron {
    width: 26px;
    height: 26px;
    background: rgba(255,255,255,.12);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 12px;
    transition: transform .25s ease;
    flex-shrink: 0;
}

    .add-plan-chevron.open {
        transform: rotate(180deg);
    }

.add-plan-body {
    display: none;
    padding: 20px;
    border-top: 1px solid var(--slate-100);
}

    .add-plan-body.open {
        display: block;
        animation: slideDown .2s ease;
    }

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.plan-hint {
    background: rgba(37,99,235,.07);
    border: 1px solid rgba(37,99,235,.18);
    border-radius: 9px;
    padding: 10px 14px;
    font-size: 12.5px;
    color: var(--slate-600);
    line-height: 1.6;
    margin-bottom: 18px;
}

    .plan-hint strong {
        color: var(--navy-900);
    }

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 6px;
}

.alert-form {
    border-radius: 9px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    flex: 1;
}

    .alert-form:empty {
        display: none;
    }

/* ════════════════════════════════════════
   DATATABLE OVERRIDES — match theme
════════════════════════════════════════ */
.dataTables_wrapper {
    font-size: 13.5px;
}
table.dataTable {
    width: 100% !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: white !important;
    border: 1px solid #111;
    background-color: #585858;
    background: linear-gradient(to bottom, #0267af 0%, #0267af 100%) !important;
    border-radius: 50px;
    border-color: #0267af !important;
    border-radius: 50px;
    border-color: #0267af;
}

th {
    font-weight: normal;
}

table.dataTable thead th, table.dataTable tfoot th {
    font-weight: normal !important;
}

/* Header row */
table.dataTable thead tr {
    background: linear-gradient(90deg, var(--navy-900), var(--navy-700));
}

table.dataTable thead th {
    color: var(--slate-300) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
    text-transform: uppercase !important;
    border-bottom: none !important;
    white-space: nowrap;
    padding: 12px 14px !important;
}

    table.dataTable thead th.sorting::after,
    table.dataTable thead th.sorting_asc::after,
    table.dataTable thead th.sorting_desc::after {
        opacity: .5;
    }

/* Body rows */
table.dataTable tbody tr {
    border-bottom: 1px solid var(--slate-100);
}

    table.dataTable tbody tr:hover {
        background: var(--slate-50) !important;
    }

table.dataTable tbody td {
    padding: 11px 14px !important;
    color: var(--slate-700);
    vertical-align: middle;
}

/* Search + length */
.dataTables_filter label {
    font-size: 13px;
    color: var(--slate-600);
}

.dataTables_filter input {
    border: 1.5px solid var(--slate-200) !important;
    border-radius: 8px !important;
    padding: 6px 11px !important;
    font-size: 13px !important;
    outline: none !important;
}

    .dataTables_filter input:focus {
        border-color: var(--blue) !important;
        box-shadow: 0 0 0 3px rgba(37,99,235,.1) !important;
    }

.dataTables_length select {
    border: 1.5px solid var(--slate-200);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
    outline: none;
}

.dataTables_info {
    font-size: 12px;
    color: var(--slate-500);
    padding-top: 10px;
}

/* Pagination */
.dataTables_paginate {
    padding-top: 10px;
}

    .dataTables_paginate .paginate_button {
        border-radius: 7px !important;
        font-size: 13px !important;
        padding: 5px 11px !important;
        margin: 0 2px !important;
        border: 1px solid var(--slate-200) !important;
        color: var(--slate-600) !important;
    }

        .dataTables_paginate .paginate_button:hover {
            background: var(--slate-100) !important;
            border-color: var(--slate-300) !important;
            color: var(--slate-700) !important;
        }

        .dataTables_paginate .paginate_button.current,
        .dataTables_paginate .paginate_button.current:hover {
            background: linear-gradient(135deg, var(--blue), var(--sky)) !important;
            border-color: var(--blue) !important;
            color: white !important;
        }

        .dataTables_paginate .paginate_button.disabled,
        .dataTables_paginate .paginate_button.disabled:hover {
            color: var(--slate-300) !important;
            background: transparent !important;
            border-color: var(--slate-100) !important;
        }

/* Export button */
.dt-buttons .dt-button {
    background: linear-gradient(135deg, var(--green), #34d399) !important;
    border: none !important;
    border-radius: 8px !important;
    color: white !important;
    font-size: 12px !important;
    padding: 7px 14px !important;
    margin-right: 6px !important;
}

    .dt-buttons .dt-button:hover {
        opacity: .88 !important;
    }

/* Action icons in table */
.dt-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    margin-right: 4px;
}

.dt-action-edit {
    background: rgba(37,99,235,.1);
    color: var(--blue);
}

    .dt-action-edit:hover {
        background: rgba(37,99,235,.2);
    }

.dt-action-delete {
    background: rgba(239,68,68,.1);
    color: var(--red);
}

    .dt-action-delete:hover {
        background: rgba(239,68,68,.2);
    }

.dt-action-btn svg {
    width: 14px;
    height: 14px;
}
/* Footer row — full width, proper spacing */
.dataTables_wrapper .row:last-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 10px 4px 4px;
    flex-wrap: wrap;
    gap: 8px;
}

    /* Info text — left side */
    .dataTables_wrapper .row:last-child > [class*="col-sm-8"],
    .dataTables_wrapper .dt-info {
        flex: 1 1 auto;
        width: auto !important;
        max-width: none !important;
        padding: 0;
        font-size: 13px;
        color: var(--color-text-secondary, #6b7280);
    }

    /* Pagination — right side */
    .dataTables_wrapper .row:last-child > [class*="col-sm-4"],
    .dataTables_wrapper .dt-paging {
        flex: 0 0 auto;
        width: auto !important;
        max-width: none !important;
        padding: 0;
    }

/* Pagination list alignment */
.dataTables_wrapper .pagination {
    margin: 0;
    justify-content: flex-end;
}
/* Kill the scroll container DataTables injects */
.dataTables_wrapper .dt-scroll {
    overflow-x: hidden !important;
    width: 100% !important;
}

.dataTables_wrapper .dt-scroll-body {
    overflow-x: hidden !important;
    width: 100% !important;
}

.dataTables_wrapper .dt-scroll-head {
    overflow: hidden !important;
    width: 100% !important;
}

/* Force table full width */
.tbl-wrap table,
.dataTables_wrapper table {
    width: 100% !important;
    table-layout: fixed !important;
}

/* Footer info + pagination row */
.dataTables_wrapper .row.w-100 {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 10px 8px 4px !important;
}

    .dataTables_wrapper .row.w-100 > [class*="col-"] {
        width: auto !important;
        max-width: none !important;
        flex: 0 0 auto !important;
        padding: 0 !important;
    }

.dataTables_wrapper .pagination {
    margin: 0 !important;
    justify-content: flex-end !important;
}
div.dt-container div.dt-paging ul.pagination {
    margin: 2px 0;
    flex-wrap: nowrap;
}
.sidebar-brand-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.password-wrapper {
    position: relative;
}

.password-wrapper {
    position: relative;
}

    .password-wrapper .form-control {
        padding-right: 45px;
    }

.eye-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    user-select: none;
    z-index: 10;
}