/* ============================================================================
   NIRA CRM — CUSTOM THEME
   Single source of truth for all bespoke styling on top of the base admin
   template. Keeps the existing brand color; only cleans up structure,
   consistency and polish across every screen (dashboard, modules, auth).
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. DESIGN TOKENS
   --------------------------------------------------------------------------- */
:root {
    --primary-color: #573100;
    --primary-dark:  #3a2000;
    --primary-600:   #452600;
    --primary-100:   #f6ede4;
    --accent-600:    #573100;
    --base-font-size: 14px;

    --text-900: #1f2937;
    --text-600: #4b5563;
    --text-400: #8a94a6;

    --border:    #e7eaef;
    --border-strong: #d9dee6;
    --surface:   #ffffff;
    --surface-muted: #f7f9fb;

    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;

    --shadow-sm: 0 2px 8px rgba(17, 24, 39, 0.05);
    --shadow-md: 0 10px 30px rgba(17, 24, 39, 0.08);
    --shadow-lg: 0 20px 45px rgba(17, 24, 39, 0.12);

    --danger:  #dc3545;
    --success: #573100;
    --indigo-600: #4f5fae;
}

/* ---------------------------------------------------------------------------
   2. BASE / BODY
   --------------------------------------------------------------------------- */
body {
    background-color: var(--surface-muted);
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--primary-100); color: var(--primary-color); }

/* Slim custom scrollbar for nav & scroll areas */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 10px; }

/* ---------------------------------------------------------------------------
   3. THEME COLOR OVERRIDES (brand consistency across bootstrap components)
   --------------------------------------------------------------------------- */
.btn-primary, .bg-primary, .btn-outline-primary:hover, .btn-outline-primary:active,
.btn-outline-primary.active, .page-main-header .nav-right .nav-menus .btn-primary,
.badge-primary, .nav-pills .nav-link.active, .page-item.active .page-link {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}
.btn-primary:hover, .btn-primary:focus { background-color: var(--primary-600) !important; border-color: var(--primary-600) !important; }

.sidebar-wrapper .sidebar-list:hover .sidebar-link, .sidebar-wrapper .sidebar-list .sidebar-link:hover,
.sidebar-wrapper .sidebar-list .sidebar-link.active, .nav-menu .nav-link:hover, .nav-menu .nav-link.active,
.nav-link.menu-title:hover, .nav-link.menu-title.active, .nav-menu .nav-submenu li a:hover {
    background-color: var(--primary-color) !important;
    color: #fff !important;
    transition: all 0.2s ease;
}
.sidebar-wrapper .sidebar-list:hover .sidebar-link h6, .nav-menu .nav-link:hover h6,
.nav-menu .nav-link:hover span, .nav-link.menu-title:hover h6, .nav-link.menu-title:hover span {
    color: #fff !important;
}
.text-primary, .btn-outline-primary, .page-link, .icofont-primary { color: var(--primary-color) !important; }
.btn-outline-primary, .border-primary { border-color: var(--primary-color) !important; }

/* ---------------------------------------------------------------------------
   4. TOP HEADER / LOGO
   --------------------------------------------------------------------------- */
.main-header-left { padding: 7px 0 !important; display: flex !important; align-items: center !important; }
.logo-wrapper { padding: 0 !important; flex-grow: 1 !important; text-align: center !important; display: flex; justify-content: center; align-items: center; }
.logo-wrapper h1 { margin: 0 auto !important; font-size: 22px; font-weight: 700; color: var(--primary-color); letter-spacing: .2px; text-decoration: none; }
.toggle-sidebar { padding-left: 10px !important; margin-right: 15px !important; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.page-main-header { box-shadow: var(--shadow-sm); }
.nav-menus li .btn-danger { border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; padding: 7px 16px; }

/* ---------------------------------------------------------------------------
   5. SIDEBAR NAVIGATION
   --------------------------------------------------------------------------- */
.page-wrapper.compact-wrapper .page-body-wrapper header.main-nav {
    top: 80px !important; height: calc(100vh - 80px) !important; transition: all 0.3s ease !important;
}
.page-wrapper.compact-wrapper .page-body-wrapper header.main-nav.close_icon {
    transform: translateX(-100%) !important; opacity: 0 !important; visibility: hidden !important;
}
.page-wrapper.compact-wrapper .page-body-wrapper header.main-nav .main-navbar .nav-menu {
    height: calc(100vh - 100px) !important; padding-top: 10px !important;
}
.main-nav .nav-menu .nav-link h6 { font-size: 13px !important; font-weight: 500 !important; margin-bottom: 0; }
.main-nav .nav-menu .nav-submenu li a { font-size: 12px !important; padding: 5px 20px !important; }
.nav-menu { padding-top: 10px !important; }
.sidebar-main-title h6 { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .55; margin: 18px 0 6px; }

/* ---------------------------------------------------------------------------
   6. PAGE HEADER (title + subtitle above each module)
   --------------------------------------------------------------------------- */
.page-header h3 { color: var(--text-900); font-weight: 700; letter-spacing: -.2px; }
.page-header p.text-muted { color: var(--text-400) !important; font-size: 13.5px; margin-top: 2px; }

/* ---------------------------------------------------------------------------
   7. CARDS — every .card gets the same premium treatment, everywhere.
   ("premium-card" kept as an explicit alias so existing markup still works)
   --------------------------------------------------------------------------- */
.card, .premium-card {
    border: 1px solid var(--border);
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card .card-header, .premium-card .card-header {
    border-radius: var(--radius) var(--radius) 0 0 !important;
    border-bottom: 1px solid var(--border);
    padding: 18px 22px !important;
    background: var(--surface);
}
.card .card-body { padding: 22px; }
.card .card-header h5, .card .card-header h6 { letter-spacing: -.1px; }

/* Dashboard stat cards */
.stat-widget {
    padding: 24px; color: #fff; border-radius: var(--radius); position: relative;
    overflow: hidden; box-shadow: var(--shadow-sm); border: none;
}
.stat-widget .icon-bg { position: absolute; right: -8px; bottom: -12px; font-size: 76px; opacity: .18; transform: rotate(-12deg); }
.stat-widget h4 { font-weight: 800; margin-bottom: 4px; font-size: 26px; }
.stat-widget p { font-size: 13px; opacity: .92; }

/* ---------------------------------------------------------------------------
   8. TABLES
   --------------------------------------------------------------------------- */
.table thead.bg-light th {
    background: var(--surface-muted) !important;
    color: var(--text-600);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
}
.table td { padding: 12px 14px; vertical-align: middle; font-size: 13.5px; color: var(--text-900); }
.table-hover tbody tr:hover { background-color: var(--primary-100); }
.table-responsive { border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------------------
   9. BADGES
   --------------------------------------------------------------------------- */
.badge { font-weight: 600; font-size: 11.5px; letter-spacing: .02em; padding: 6px 10px; border-radius: 6px; }
.badge.rounded-pill { border-radius: 50px; }

/* ---------------------------------------------------------------------------
   10. FORMS
   --------------------------------------------------------------------------- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-strong);
    font-size: 13.5px;
    padding: 9px 13px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.input-group-text { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-color: var(--border-strong); color: var(--text-400); }
label, .form-label { font-size: 13px; font-weight: 600; color: var(--text-600); }

/* ---------------------------------------------------------------------------
   11. BUTTONS
   --------------------------------------------------------------------------- */
.btn { border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; padding: 8px 16px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 10px; font-size: 11.5px; border-radius: 6px; }

/* ---------------------------------------------------------------------------
   12. ALERTS / FLASH MESSAGES
   --------------------------------------------------------------------------- */
.alert { border-radius: var(--radius-sm); border: none; box-shadow: var(--shadow-sm); font-size: 13.5px; }

/* ---------------------------------------------------------------------------
   13. PAGINATION
   --------------------------------------------------------------------------- */
.pagination .page-link { border-radius: 6px; margin: 0 2px; border-color: var(--border); color: var(--text-600); font-size: 13px; }
.pagination .page-item.active .page-link { box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------------------
   14. EMPTY STATES
   --------------------------------------------------------------------------- */
td .text-muted h5 { color: var(--text-600) !important; font-weight: 600; }

/* ---------------------------------------------------------------------------
   15. SHARED WIDGETS — order/customer search dropdown, item tables,
   totals box, sticky pay bar. Previously duplicated (and broken, referencing
   undefined variables) inside orders_add.php / sales.php.
   --------------------------------------------------------------------------- */
/* Search UI extracted to the bottom */

table.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.items-table th { text-align: left; padding: 8px; color: var(--text-400); font-weight: 600; font-size: 11.5px; text-transform: uppercase; border-bottom: 1px solid var(--border); }
table.items-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.items-table input { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; }

.totals-box { max-width: 340px; margin-left: auto; margin-top: 16px; }
.totals-box .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; }
.totals-box .row.grand { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 15.5px; }
.totals-box input { width: 130px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; text-align: right; font-size: 13px; }

.sticky-pay-bar {
    position: sticky; bottom: 14px; margin-top: 16px; background: var(--primary-color); color: #fff;
    border-radius: var(--radius); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between;
    box-shadow: var(--shadow-md); gap: 14px; flex-wrap: wrap;
}
.sticky-pay-bar .info { font-size: 13.5px; }
.sticky-pay-bar .info strong { font-size: 16px; }

/* ---------------------------------------------------------------------------
   16. AUTH SCREENS (login split-screen + first-run setup wizard)
   Previously unstyled — these classes did not exist anywhere in the CSS.
   --------------------------------------------------------------------------- */
.auth-body {
    margin: 0; min-height: 100vh; font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--surface-muted);
}
.auth-shell { display: flex; min-height: 100vh; }

/* Left brand / story panel */
.auth-visual {
    flex: 1 1 50%; max-width: 50%; display: flex; flex-direction: column; justify-content: space-between; align-items: center; text-align: center;
    padding: 64px 48px; color: #fff;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    position: relative; overflow: hidden;
}
.auth-visual::before {
    content: ""; position: absolute; width: 600px; height: 600px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 70%);
    top: -200px; right: -200px; filter: blur(40px);
}
.auth-visual::after {
    content: ""; position: absolute; width: 500px; height: 500px; border-radius: 50%;
    background: radial-gradient(circle, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 70%);
    bottom: -150px; left: -150px; filter: blur(50px);
}
.auth-visual-top { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; position: relative; z-index: 1; margin-bottom: 40px; }
.auth-visual-foot { position: relative; z-index: 1; font-size: 12.5px; color: rgba(255,255,255,0.6); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 50px; }
.auth-brand h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.auth-brand p { margin: 0; font-size: 13.5px; opacity: 0.9; }
.auth-visual-headline { font-size: 34px; font-weight: 700; line-height: 1.25; margin-bottom: 20px; max-width: 460px; letter-spacing: -0.02em; }
.auth-visual-headline em { font-style: normal; color: #f2c994; }
.auth-visual-sub { font-size: 15px; line-height: 1.6; color: rgba(255,255,255,0.85); max-width: 440px; margin-bottom: 40px; }
.auth-visual-features { list-style: none; padding: 0; margin: 0 auto; display: inline-flex; flex-direction: column; gap: 16px; align-items: flex-start; text-align: left; }
.auth-visual-features li { display: flex; align-items: center; gap: 14px; font-size: 15px; font-weight: 500; color: rgba(255,255,255,0.95); }
.auth-visual-features svg { flex: none; width: 22px; height: 22px; padding: 4px; background: rgba(255,255,255,0.15); border-radius: 50%; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

/* Right credentials panel */
.auth-form-side { flex: 1 1 50%; max-width: 50%; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-wrap { width: 100%; max-width: 440px; }
.auth-centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-centered .auth-wrap { max-width: 440px; }

.auth-card {
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    padding: 48px 40px; border: 1px solid var(--border);
}
.auth-card .auth-brand { margin-bottom: 24px; }
.auth-card .auth-brand-mark {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: 10px; font-weight: 800; font-size: 18px;
}
.auth-title { font-size: 22px; font-weight: 700; color: var(--text-900); margin-bottom: 6px; }
.auth-sub { font-size: 13.5px; color: var(--text-400); margin-bottom: 24px; }

.auth-methods { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-methods button {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-600);
    cursor: pointer; transition: all .15s ease;
}
.auth-methods button svg { width: 16px; height: 16px; }
.auth-methods button.active { border-color: var(--primary-color); color: var(--primary-color); background: var(--primary-100); }
.auth-methods button:disabled { opacity: .45; cursor: not-allowed; }

.auth-alert { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; margin-bottom: 18px; }
.auth-alert-error { background: #fdecec; color: #c0392b; border: 1px solid #f6cfcf; }
.auth-alert-success { background: var(--primary-100); color: var(--primary-600); border: 1px solid rgba(87,49,0,.2); }

.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-600); margin-bottom: 6px; }
.form-field input {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 13.5px; font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-100); }

.btn-primary.btn-block, a.btn-primary.btn-block {
    display: block; width: 100%; text-align: center; padding: 12px 16px; border-radius: var(--radius-sm);
    background: var(--primary-color); color: #fff; border: none; font-size: 14px; font-weight: 700;
    cursor: pointer; transition: background .15s ease; margin-top: 6px;
}
.btn-primary.btn-block:hover { background: var(--primary-600); }

.auth-footnote { text-align: center; font-size: 12.5px; color: var(--text-400); margin-top: 20px; }

/* ---------------------------------------------------------------------------
   17. RESPONSIVE ADJUSTMENTS
   --------------------------------------------------------------------------- */
@media (max-width: 991px) {
    .auth-visual { display: none; }
    .auth-form-side { padding: 20px; }
}
@media (max-width: 575px) {
    .card .card-body { padding: 16px; }
    .card .card-header { padding: 14px 16px !important; }
    .stat-widget { padding: 18px; }
    .auth-card { padding: 28px 22px; }
}

/* ---------------------------------------------------------------------------
   18. NEW FORM COMPONENT LAYOUTS
   --------------------------------------------------------------------------- */
.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.section-divider {
    border-top: 1px solid var(--border);
    margin: 18px 0 14px;
}
.image-preview-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}
.image-preview-box {
    width: 100%;
    height: 110px;
    border: 2px dashed var(--border-strong);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-muted);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s;
}
.image-preview-box:hover {
    border-color: var(--primary-color);
}
.image-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}
.image-preview-box .placeholder-icon {
    text-align: center;
    color: var(--text-400);
}
.image-preview-box .placeholder-icon i {
    font-size: 26px;
    display: block;
    margin-bottom: 4px;
}
.image-preview-box .placeholder-icon span {
    font-size: 11px;
}
.image-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.image-remove-btn.visible {
    display: flex;
}
.image-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-600);
    margin-bottom: 4px;
    display: block;
}

/* ---------------------------------------------------------------------------
   19. PREMIUM EFFECTS (Extracted from Orders)
   --------------------------------------------------------------------------- */
.premium-card {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05) !important;
    background: #fff;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.premium-card:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.08) !important;
}
.table > tbody > tr {
    transition: all 0.2s ease;
}
.table-hover > tbody > tr:hover {
    background-color: #f8faff !important;
    transform: scale(1.002);
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.table td {
    vertical-align: middle;
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}
.badge {
    font-weight: 500;
    padding: 0.5em 0.8em;
    border-radius: 30px;
}
.btn-light {
    background-color: #f9f9f9;
    transition: all 0.2s;
}
.btn-light:hover {
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.btn-primary {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(87, 49, 0, 0.25);
    transition: all 0.2s ease;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(87, 49, 0, 0.35);
}
/* ---------------------------------------------------------------------------
   18. AUTOCOMPLETE SEARCH RESULTS
   --------------------------------------------------------------------------- */
.table-responsive {
    overflow: visible !important;
}
.items-table tr:focus-within {
    position: relative;
    z-index: 9999;
}
.items-table td:focus-within {
    position: relative;
    z-index: 10000;
}
.order-search-wrap {
    position: relative;
}
.order-search-wrap:focus-within {
    z-index: 10000;
}
.order-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    min-width: 350px;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
    z-index: 999999;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}
.order-search-results.open {
    display: block;
}
.order-search-results .res-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: padding-left 0.2s ease, background 0.2s ease;
    opacity: 1 !important;
}
.order-search-results .res-item:last-child {
    border-bottom: none;
}
.order-search-results .res-item:hover {
    background: var(--primary-100);
    padding-left: 20px;
}
.order-search-results .res-item strong {
    display: block;
    color: var(--primary-dark);
    font-size: 14.5px;
    font-weight: 600;
    margin-bottom: 3px;
}
.order-search-results .res-item small {
    display: block;
    color: var(--text-600);
    font-size: 12.5px;
}
.selected-customer-box {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface-muted);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    margin-top: 8px;
}
.selected-customer-box.show {
    display: flex;
}
