/* ── Base body typography ── */
body {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
}

/* ── Color Palette Variables ── */
:root {
    /* Primary – Indigo (Strengthened for better visibility) */
    --clr-primary:         #4f46e5;   /* indigo-600 */
    --clr-primary-hover:   #4338ca;   /* indigo-700 */
    --clr-primary-dark:    #3730a3;   /* indigo-800 */
    --clr-primary-light:   #eef2ff;   /* indigo-50  */
    --clr-primary-border:  #c7d2fe;   /* indigo-200 */
    --clr-primary-ring:    rgba(79, 70, 229, 0.15);

    /* Success – Emerald (Darkened for better contrast) */
    --clr-success:         #059669;   /* emerald-600 */
    --clr-success-hover:   #047857;   /* emerald-700 */
    --clr-success-light:   #d1fae5;   /* emerald-100 */

    /* Danger – Red */
    --clr-danger:          #dc2626;   /* red-600 */
    --clr-danger-light:    #fee2e2;   /* red-100  */
    --clr-danger-border:   #fecaca;   /* red-200  */

    /* Neutral */
    --clr-gray-50:   #f9fafb;
    --clr-gray-100:  #f3f4f6;
    --clr-gray-200:  #e5e7eb;
    --clr-gray-300:  #d1d5db;
    --clr-gray-500:  #6b7280;
    --clr-gray-600:  #4b5563;
    --clr-gray-700:  #374151;
}

/* ────────────────────────────────────────────────
   Furniture POS — Custom Styles
──────────────────────────────────────────────── */
/* Sidebar Logo */
.img-sidebar-logo {
    width: auto;
    height: 35px;
    border-radius: 6px;
}

/* ── Status Badges ── */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 9px; border-radius: 9999px;
    font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
}
.badge-pending    { background: #fef9c3; color: #713f12; }
.badge-processing,.badge-in_transit,.badge-open { background: #e0f2fe; color: #075985; }
.badge-partial_delivered { background: #fde68a; color: #92400e; }
.badge-completed,.badge-received,.badge-active,.badge-approved { background: #dcfce7; color: #14532d; }
.badge-cancelled,.badge-rejected,.badge-inactive { background: #fee2e2; color: #7f1d1d; }
.badge-refunded  { background: #ede9fe; color: #3b0764; }
.badge-resolved,.badge-closed { background: #f3f4f6; color: #374151; }

/* ── Sidebar ── */
#sidebar { transition: width 0.2s ease, min-width 0.2s ease; }
#sidebar.sidebar-collapsed { width: 0 !important; min-width: 0 !important; overflow: hidden !important; }

/* ── DataTables ── */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse;
    font-size: 13px;
}
table.dataTable thead th {
    padding: 11px 14px;
    background: #fff;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #374151;
    white-space: nowrap;
    cursor: pointer;
    text-align: left;
}
table.dataTable thead th:hover { color: #111827; }
table.dataTable tbody tr { border-bottom: 1px solid #f3f4f6; transition: background 0.1s; }
table.dataTable tbody tr:hover { background: #fafafa; }
table.dataTable tbody tr:last-child { border-bottom: none; }
table.dataTable tbody td { padding: 10px 14px; vertical-align: middle; color: #374151;font-size: 14px; }
.dt-container { font-size: 13px; }
.dt-layout-row {
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 8px; margin: 0 0 12px; flex-wrap: wrap;
}
.dt-layout-row:last-child { margin: 12px 0 0; }
.dt-search label { display: flex; align-items: center; }
.dt-search input {
    padding: 6px 10px;
    border: 1px solid #e5e7eb; border-radius: 8px;
    font-size: 12.5px; outline: none;
    background: white; color: #374151; width: 200px;
}
.dt-search input:focus { border-color: var(--clr-primary); box-shadow: 0 0 0 3px var(--clr-primary-ring); }
.dt-length label { display: flex; align-items: center; }
.dt-length select {
    padding: 5px 8px; border: 1px solid #e5e7eb; border-radius: 8px;
    font-size: 12.5px; outline: none; background: white; color: #374151; cursor: pointer;
}
.dt-info { font-size: 12px; color: #9ca3af; }
.dt-paging { display: flex; align-items: center; gap: 2px; }
.dt-paging .dt-paging-button {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 6px;
    border-radius: 6px; font-size: 12.5px; cursor: pointer;
    color: #374151; border: 1px solid transparent; transition: all 0.1s;
    background: transparent;
}
.dt-paging .dt-paging-button:hover:not(.disabled) { background: #f3f4f6; border-color: #e5e7eb; }
.dt-paging .dt-paging-button.current { background: var(--clr-primary); color: white; border-color: var(--clr-primary); }
.dt-paging .dt-paging-button.disabled { color: #d1d5db; cursor: default; }

/* ── DT Action Buttons (legacy text labels, kept for static use) ── */
.dt-btn {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 6px;
    font-size: 11.5px; font-weight: 500;
    cursor: pointer; transition: all 0.15s;
    border: 1px solid; text-decoration: none; white-space: nowrap;
}
.dt-btn + .dt-btn { margin-left: 4px; }
.dt-btn-view { color: var(--clr-primary-dark); border-color: var(--clr-primary-border); background: var(--clr-primary-light); }
.dt-btn-view:hover { background: #e0e7ff; }
.dt-btn-edit { color: var(--clr-gray-700); border-color: var(--clr-gray-200); background: var(--clr-gray-50); }
.dt-btn-edit:hover { background: var(--clr-gray-100); border-color: var(--clr-gray-300); }
.dt-btn-del { color: var(--clr-danger); border-color: var(--clr-danger-border); background: #fef2f2; }
.dt-btn-del:hover { background: var(--clr-danger-light); }
.dt-btn-success { color: var(--clr-success); border-color: #a7f3d0; background: #ecfdf5; }
.dt-btn-success:hover { background: var(--clr-success-light); }
.dt-btn-info { color: #0369a1; border-color: #bae6fd; background: #f0f9ff; }
.dt-btn-info:hover { background: #e0f2fe; }

/* ── DT Action Icon Buttons ── */
.dt-action-wrap { display: inline-flex; align-items: center; gap: 6px; }
.dt-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    cursor: pointer;
    border: none; background: none; text-decoration: none;
    font-size: 15px;
}
.dt-icon-btn:hover { opacity: 1; transform: scale(1.1); }
.dt-icon-view    { color: var(--clr-primary); }
.dt-icon-edit    { color: var(--clr-gray-500); }
.dt-icon-del     { color: var(--clr-danger); }
.dt-icon-info    { color: #0ea5e9; }
.dt-icon-success { color: var(--clr-success); }

/* ── Status Toggle Switch ── */
.status-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    cursor: pointer;
    vertical-align: middle;
}
.status-switch-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.status-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: #d1d5db;
    transition: background-color 0.2s ease;
}
.status-switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: left 0.2s ease;
}
.status-switch.is-on .status-switch-track {
    background: #22c55e;
}
.status-switch.is-on .status-switch-knob {
    left: 20px;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.hidden { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.35); backdrop-filter: blur(2px); }
.modal-box {
    position: relative; background: white;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.04);
    width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
    animation: modalIn 0.15s ease;
}
.modal-box-lg { max-width: 720px; }
@keyframes modalIn {
    from { transform: translateY(-6px) scale(0.99); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 20px; border-bottom: 1px solid #f3f4f6;
}
.modal-header h3 { font-size: 14px; font-weight: 600; color: #111827; margin: 0; }
.modal-close {
    width: 28px; height: 28px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none; cursor: pointer;
    color: #9ca3af; font-size: 18px; line-height: 1; transition: all 0.1s;
}
.modal-close:hover { background: #f3f4f6; color: #374151; }
.modal-body { padding: 20px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 20px; border-top: 1px solid #f3f4f6;
    background: #fafafa; border-radius: 0 0 14px 14px;
}

/* ── Confirm Modal (SweetAlert-like) ── */
.confirm-modal-box {
    max-width: 480px;
    border-radius: 16px;
    overflow: hidden;
}
.confirm-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}
.confirm-modal-close:hover {
    background: #f3f4f6;
}
.confirm-modal-body {
    padding: 34px 28px 22px;
    text-align: center;
}
.confirm-modal-icon {
    width: 74px;
    height: 74px;
    margin: 0 auto 16px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.confirm-modal-icon-glyph {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
}
.confirm-icon-warning,
.confirm-icon-danger {
    color: #b42318;
    background: linear-gradient(145deg, #fee4e2 0%, #fecdca 100%);
    border: 3px solid #fda29b;
}
.confirm-icon-info {
    color: #175cd3;
    background: linear-gradient(145deg, #d1e9ff 0%, #b2ddff 100%);
    border: 3px solid #84caff;
}
.confirm-icon-success {
    color: #027a48;
    background: linear-gradient(145deg, #d1fadf 0%, #a6f4c5 100%);
    border: 3px solid #6ce9a6;
}
.confirm-icon-question {
    color: #344054;
    background: linear-gradient(145deg, #eaecf0 0%, #d0d5dd 100%);
    border: 3px solid #98a2b3;
}
.confirm-icon-none {
    display: none;
}
.confirm-modal-message {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 500;
}
.confirm-modal-description {
    max-width: 360px;
    margin: 0 auto;
    font-size: 15px;
    line-height: 1.45;
    color: #6b7280;
}
.confirm-modal-footer {
    background: #fcfcfd;
    border-top: 1px solid #eaecf0;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px 16px;
}
.confirm-btn {
    min-width: 110px;
    justify-content: center;
    border-radius: 10px;
    font-weight: 600;
    padding: 8px 14px;
}

@media (max-width: 640px) {
    .confirm-modal-box {
        max-width: 94vw;
    }
    .confirm-modal-body {
        padding: 26px 18px 18px;
    }
}

/* ── Simple table (non-DataTables) ── */
.simple-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.simple-table thead th {
    padding: 9px 12px; background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.05em; color: #374151; text-align: left;
}
.simple-table tbody tr { border-bottom: 1px solid #f3f4f6; }
.simple-table tbody tr:last-child { border-bottom: none; }
.simple-table tbody td { padding: 9px 12px; vertical-align: middle; color: #374151; }

/* ── Tabs ── */
.tab-nav { display: flex; border-bottom: 1px solid #e5e7eb; margin-bottom: 20px; }
.tab-btn {
    padding: 9px 16px; font-size: 13px; font-weight: 500;
    color: #6b7280; border: none; background: transparent;
    border-bottom: 2px solid transparent; cursor: pointer;
    transition: all 0.15s; margin-bottom: -1px;
}
.tab-btn:hover { color: #374151; }
.tab-btn.active { color: var(--clr-primary); border-bottom-color: var(--clr-primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Monospace ── */
.font-mono { font-family: 'SF Mono','Fira Code','Courier New',monospace; font-size: 12px; }

/* ── Search result list ── */
.list-result-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px; color: #374151; transition: background 0.1s; text-decoration: none;
}
.list-result-item:hover { background: #f9fafb; }
.list-result-item:last-child { border-bottom: none; }

/* ── Toastr ── */
#toast-container > .toast {
    border-radius: 10px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1) !important;
    font-size: 13px !important;
}

/* ── Form Input / Label ── */
.form-input {
    width: 100%; padding: 8px 12px;
    border: 1px solid #e5e7eb; border-radius: 8px;
    font-size: 13px; color: #374151; background: white;
    outline: none; transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit; display: block;
}
.form-input:focus { border-color: var(--clr-primary); box-shadow: 0 0 0 3px var(--clr-primary-ring); }
.form-input.is-invalid { border-color: #f87171; }
.form-input[readonly], .form-input[disabled] { background: #f9fafb; color: #6b7280; cursor: not-allowed; }
.phone-field { display: flex; align-items: stretch; width: 100%; border: 1px solid #e5e7eb; border-radius: 8px; background: white; transition: border-color 0.15s, box-shadow 0.15s; overflow: hidden; }
.phone-field:focus-within { border-color: var(--clr-primary); box-shadow: 0 0 0 3px var(--clr-primary-ring); }
.phone-field.is-invalid { border-color: #f87171; }
.phone-field-country { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 0 12px; border-right: 1px solid #e5e7eb; background: #fcfcfd; }
.phone-field-flag { font-size: 16px; line-height: 1; }
.phone-field-code { color: #374151; font-size: 13px; font-weight: 500; }
.phone-field-input { border: 0; border-radius: 0; box-shadow: none; padding: 8px 12px; }
.phone-field-input:focus { border-color: transparent; box-shadow: none; }
.form-input-sm { padding: 5px 10px; font-size: 13px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.form-label-inline { display: block; font-size: 14px; font-weight: 600; color: #374151; }
.form-error { display: block; font-size: 13px; color: var(--clr-danger); margin-top: 4px; }

/* ── Layout Cards ── */
.page-card { background: white; border: 1px solid #f3f4f6; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 20px; border-bottom: 1px solid #f3f4f6;
}
.card-header h2, .card-header h3 { font-size: 14px; font-weight: 600; color: #111827; margin: 0; }
.card-body { padding: 20px; }

/* ── Page Header (flat full-width bar at top of content panels) ── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 2px solid #f3f4f6;
}

/* ── Page / Section Heading ── */
.page-heading { font-size: 18px; font-weight: 700; color: #111827; margin: 0; letter-spacing: -0.01em; }

/* ── Sidebar Nav Links ── */
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 8px;
    font-size: 15.5px; color: #374151;
    text-decoration: none; white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}
.nav-link:hover { background-color: #f3f4f6; color: #111827; }
.nav-link.active { background-color: #eef2ff; color: #4338ca; font-weight: 600; }
.nav-section-label {
    display: block; padding: 12px 14px 6px;
    font-size: 12px; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap;
}

/* ── Dashboard Stat Cards ── */
.stat-card { background: white; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); padding: 24px; }
.stat-card-label { font-size: 13px; font-weight: 600; color: #4b5563; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.stat-card-value { font-size: 32px; font-weight: 800; line-height: 1; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14.5px; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
    border: 1px solid transparent;
    text-decoration: none; white-space: nowrap; line-height: 1.4;
}
.btn-sm { padding: 6px 14px; font-size: 13.5px; }
.btn-primary {
    background: var(--clr-primary); color: white;
    border-color: var(--clr-primary);
}
.btn-primary:hover { background: var(--clr-primary-hover); border-color: var(--clr-primary-hover); }
.btn-primary:focus { outline: none; box-shadow: 0 0 0 2px white, 0 0 0 4px var(--clr-primary); }
.btn-secondary {
    background: var(--clr-gray-100); color: var(--clr-gray-700);
    border-color: var(--clr-gray-200);
}
.btn-secondary:hover { background: var(--clr-gray-200); border-color: var(--clr-gray-300); }
.btn-success {
    background: var(--clr-success); color: white;
    border-color: var(--clr-success);
}
.btn-success:hover { background: var(--clr-success-hover); border-color: var(--clr-success-hover); }
.btn-danger {
    background: transparent; color: var(--clr-danger);
    border-color: var(--clr-danger-border);
}
.btn-danger:hover { background: var(--clr-danger-light); }
.btn-ghost {
    background: transparent; color: var(--clr-gray-600);
    border-color: var(--clr-gray-200);
}
.btn-ghost:hover { background: var(--clr-gray-50); }
.btn-outline-primary {
    background: transparent; color: var(--clr-primary-dark);
    border-color: var(--clr-primary-border);
}
.btn-outline-primary:hover { background: var(--clr-primary-light); }

/* ── Select2 — Tailwind-compatible overrides ── */

/* Prevent horizontal scrollbar when Select2 dropdown appends to body */
body { overflow-x: hidden; }

/* Fix Tailwind preflight box-sizing on all Select2 elements */
.select2-container *,
.select2-container *::before,
.select2-container *::after,
.select2-dropdown *,
.select2-dropdown *::before,
.select2-dropdown *::after { box-sizing: border-box; }

/* Prevent horizontal scrollbar when dropdown opens */
.select2-container { display: block; width: 100% !important; max-width: 100%; }
.select2-dropdown { box-sizing: border-box !important; }

/* Trigger (closed state) */
.select2-container--default .select2-selection--single {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    height: auto;
    min-height: 36px;
    background: #fff;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    position: relative;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 4px 52px 4px 12px;
    font-size: 13px;
    color: #374151;
    line-height: 1.5;
    box-sizing: border-box;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #9ca3af; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 8px;
    width: 18px;
}

/* Focus / open state */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px var(--clr-primary-ring);
    outline: none;
}

/* Clear button */
.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute;
    top: 50%;
    right: 28px;
    transform: translateY(-50%);
    float: none;
    margin: 0;
    padding: 0;
    height: 16px;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    color: #9ca3af;
    z-index: 2;
}
.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    color: #6b7280;
}

/* Dropdown panel */
.select2-dropdown {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    font-size: 13px;
    overflow: hidden; /* clip content so border-radius shows */
}

/* Search field inside dropdown */
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    padding: 5px 10px;
    outline: none;
    box-sizing: border-box;
    width: 100%;
}

/* Results list */
.select2-results__option { padding: 7px 12px; white-space: normal; word-break: break-word; }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--clr-primary); color: #fff; border-radius: 4px;
}
.select2-container--default .select2-results__option[aria-selected=true] { background: #f0f9ff; color: #374151; }
.select2-results__option--loading { color: #9ca3af; font-style: italic; }
.select2-container--default .select2-results__option.select2-results__option--create {
    color: var(--clr-primary-dark); font-weight: 500;
}
.select2-create-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--clr-primary-dark);
    font-weight: 500;
}
.select2-results__message {
    color: #6b7280;
    font-size: 12px;
}
