/* ==========================================================================
   theme-refine.css — white-theme design system refinement layer

   Loaded AFTER modern-admin.css, so these rules resolve ties against it.
   Keep this file for tokens, new components and cross-cutting polish;
   modern-admin.css stays as the original shell/sidebar/table styling.
   ========================================================================== */

:root {
    /* Accent ramp */
    --primary-50:  #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;

    /* Neutral ramp */
    --ink-900: #0f172a;
    --ink-700: #334155;
    --ink-600: #475569;
    --ink-500: #64748b;
    --ink-400: #94a3b8;
    --line: #e2e8f0;
    --line-soft: #f1f5f9;
    --surface: #ffffff;
    --surface-sunken: #f8fafc;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .05), 0 1px 2px rgba(15, 23, 42, .03);
    --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, .06), 0 2px 6px -1px rgba(15, 23, 42, .03);
    --shadow-lg: 0 16px 40px -8px rgba(15, 23, 42, .10), 0 4px 12px -2px rgba(15, 23, 42, .04);
    --shadow-primary: 0 6px 18px rgba(99, 102, 241, .25);

    /* Radii */
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
}

/* Keep the canvas light even if a stale dark theme sits in sessionStorage */
html,
html[data-bs-theme="dark"] {
    background-color: var(--surface-sunken) !important;
}

body {
    color: var(--ink-700) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.006em;
}


/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--ink-900) !important;
    font-weight: 700 !important;
    letter-spacing: -0.021em !important;
}

.text-muted,
.text-secondary {
    color: var(--ink-500) !important;
}

/* Small-caps label used above stats, filters and section titles */
.eyebrow {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-500);
}


/* --------------------------------------------------------------------------
   Auth / login
   -------------------------------------------------------------------------- */

body.auth-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background:
        radial-gradient(1100px 560px at 12% -10%, #e0e7ff 0%, rgba(224, 231, 255, 0) 60%),
        radial-gradient(900px 520px at 92% 8%, #dbeafe 0%, rgba(219, 234, 254, 0) 62%),
        radial-gradient(760px 620px at 70% 108%, #ede9fe 0%, rgba(237, 233, 254, 0) 58%),
        #f8fafc !important;
}

/* Soft drifting orbs behind the card */
body.auth-body::before,
body.auth-body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
    pointer-events: none;
    z-index: 0;
}

body.auth-body::before {
    width: 420px;
    height: 420px;
    top: -120px;
    left: -110px;
    background: radial-gradient(circle, rgba(129, 140, 248, .55), transparent 70%);
    animation: auth-drift 18s ease-in-out infinite;
}

body.auth-body::after {
    width: 380px;
    height: 380px;
    bottom: -130px;
    right: -100px;
    background: radial-gradient(circle, rgba(96, 165, 250, .45), transparent 70%);
    animation: auth-drift 22s ease-in-out infinite reverse;
}

@keyframes auth-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(28px, 34px) scale(1.08); }
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 430px;
}

.auth-card {
    background: rgba(255, 255, 255, .82) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .9) !important;
    border-radius: 22px !important;
    box-shadow:
        0 24px 60px -12px rgba(15, 23, 42, .14),
        0 8px 20px -6px rgba(15, 23, 42, .06),
        inset 0 1px 0 rgba(255, 255, 255, .85) !important;
    padding: 40px 36px 32px !important;
    animation: auth-rise .55s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes auth-rise {
    from { opacity: 0; transform: translateY(18px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

/* The global .card:hover lift must not apply to the login card */
.auth-card:hover {
    transform: none !important;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 20px;
    padding: 10px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.auth-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.auth-title {
    text-align: center;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: var(--ink-900) !important;
    margin: 0 0 6px !important;
    letter-spacing: -0.025em !important;
}

.auth-subtitle {
    text-align: center;
    font-size: .875rem;
    color: var(--ink-500);
    margin-bottom: 28px;
}

.auth-card .form-label {
    font-size: .8rem !important;
    font-weight: 600 !important;
    color: var(--ink-600) !important;
    margin-bottom: 7px !important;
    letter-spacing: -0.005em;
}

/* Input with a leading icon */
.auth-field {
    position: relative;
    margin-bottom: 18px;
}

.auth-field i.field-icon {
    position: absolute;
    left: 15px;
    top: 41px;
    font-size: 1.05rem;
    color: var(--ink-400);
    pointer-events: none;
    transition: color .2s ease;
    line-height: 1;
}

.auth-field .form-control {
    padding-left: 44px !important;
    height: 48px !important;
    background: #ffffff !important;
    border-radius: var(--r-lg) !important;
    font-size: .9rem !important;
}

.auth-field:focus-within i.field-icon {
    color: var(--primary-600);
}

/* Show/hide password toggle */
.auth-field .pw-toggle {
    position: absolute;
    right: 6px;
    top: 32px;
    background: transparent;
    border: 0;
    padding: 8px 10px;
    color: var(--ink-400);
    cursor: pointer;
    line-height: 1;
    border-radius: var(--r-sm);
    transition: color .2s ease, background .2s ease;
}

.auth-field .pw-toggle:hover {
    color: var(--primary-600);
    background: var(--primary-50);
}

.btn-auth {
    width: 100%;
    height: 48px;
    border: none !important;
    border-radius: var(--r-lg) !important;
    font-size: .925rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%) !important;
    box-shadow: var(--shadow-primary) !important;
    letter-spacing: -0.01em;
}

.btn-auth:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 26px rgba(79, 70, 229, .34) !important;
    color: #ffffff !important;
}

.auth-footnote {
    text-align: center;
    margin: 26px 0 0;
    font-size: .78rem;
    color: var(--ink-400);
}


/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer,
.footer .container-fluid {
    background: transparent !important;
    border: 0 !important;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 18px 4px;
    border-top: 1px solid var(--line);
    font-size: .8rem;
    color: var(--ink-500);
}

.app-footer p {
    margin: 0;
}

.app-footer .footer-brand {
    font-weight: 600;
    color: var(--ink-700);
}


/* --------------------------------------------------------------------------
   Utilities replacing hard-coded inline styles in the views
   -------------------------------------------------------------------------- */

/* Count pill next to section titles */
.totalCount {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 24px !important;
    padding: 3px 9px !important;
    background: var(--primary-50) !important;
    color: var(--primary-600) !important;
    border: 1px solid var(--primary-200) !important;
    border-radius: 999px !important;
    font-size: .75rem !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
}

/* Chart + scroll containers */
.chart-box {
    min-width: 300px;
    height: 400px;
    margin: 0 auto;
}

.scroll-y {
    overflow-y: auto;
    margin: 0 auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.scroll-y-300 { max-height: 300px; }
.scroll-y-400 { max-height: 400px; }

.scroll-y::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }
.scroll-y::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.scroll-y::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* Global scrollbar treatment */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-400);
    background-clip: content-box;
}


/* --------------------------------------------------------------------------
   Soft status pills
   -------------------------------------------------------------------------- */

.badge,
.bg-success, .bg-danger, .bg-warning, .bg-primary,
.bg-info, .bg-secondary, .bg-purple, .bg-pink, .bg-dark {
    display: inline-block;
    padding: 4px 10px !important;
    border-radius: 8px !important;
    font-size: .75rem !important;
    font-weight: 600 !important;
    line-height: 1.45 !important;
    white-space: nowrap;
}

.bg-info {
    background-color: #ecfeff !important;
    color: #0891b2 !important;
    border: 1px solid #a5f3fc !important;
}

.bg-secondary {
    background-color: var(--surface-sunken) !important;
    color: var(--ink-500) !important;
    border: 1px solid var(--line) !important;
}

.bg-purple {
    background-color: #faf5ff !important;
    color: #9333ea !important;
    border: 1px solid #e9d5ff !important;
}

.bg-pink {
    background-color: #fdf2f8 !important;
    color: #db2777 !important;
    border: 1px solid #fbcfe8 !important;
}

.bg-dark {
    background-color: #f1f5f9 !important;
    color: var(--ink-900) !important;
    border: 1px solid var(--line) !important;
}


/* --------------------------------------------------------------------------
   Component polish
   -------------------------------------------------------------------------- */

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--line-soft) !important;
    padding: 18px 22px !important;
}

.card-header h4,
.card-header h5 {
    margin-bottom: 0 !important;
    font-size: 1rem !important;
}

.card-body {
    padding: 22px !important;
}

/* A table inside a card should not double up on borders */
.card .table-responsive {
    border: 0 !important;
    box-shadow: none !important;
    margin-bottom: 0 !important;
}

.table > :not(caption) > * > * {
    box-shadow: none !important;
}

.table tbody tr:last-child td {
    border-bottom: 0 !important;
}

/* Alerts */
.alert {
    border: 1px solid transparent !important;
    border-radius: var(--r-lg) !important;
    padding: 13px 18px !important;
    font-size: .875rem !important;
    font-weight: 500 !important;
    box-shadow: var(--shadow-xs) !important;
}

.alert-success { background: #ecfdf5 !important; color: #047857 !important; border-color: #a7f3d0 !important; }
.alert-danger  { background: #fef2f2 !important; color: #b91c1c !important; border-color: #fecaca !important; }
.alert-warning { background: #fffbeb !important; color: #b45309 !important; border-color: #fde68a !important; }
.alert-info    { background: var(--primary-50) !important; color: var(--primary-700) !important; border-color: var(--primary-200) !important; }

/* Modals */
.modal-content {
    border: 1px solid var(--line) !important;
    border-radius: var(--r-xl) !important;
    box-shadow: var(--shadow-lg) !important;
}

.modal-header,
.modal-footer {
    border-color: var(--line-soft) !important;
    padding: 18px 22px !important;
}

.modal-body { padding: 22px !important; }

.modal-backdrop.show { opacity: .35 !important; }

/* Dropdowns */
.dropdown-menu {
    border: 1px solid var(--line) !important;
    border-radius: var(--r-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 6px !important;
}

.dropdown-item {
    border-radius: var(--r-sm) !important;
    padding: 9px 12px !important;
    font-size: .85rem !important;
    font-weight: 500 !important;
    color: var(--ink-700) !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--surface-sunken) !important;
    color: var(--primary-600) !important;
}

/* Breadcrumbs */
.breadcrumb {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: .8rem !important;
}

.breadcrumb-item a {
    color: var(--ink-500) !important;
    text-decoration: none !important;
}

.breadcrumb-item a:hover { color: var(--primary-600) !important; }
.breadcrumb-item.active { color: var(--ink-900) !important; font-weight: 600 !important; }

/* Third-party widgets: Chosen, daterangepicker, toastr */
.chosen-container-single .chosen-single,
.chosen-container-multi .chosen-choices {
    height: auto !important;
    min-height: 42px !important;
    padding: 8px 14px !important;
    background: var(--surface-sunken) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--r-md) !important;
    box-shadow: none !important;
    font-size: .875rem !important;
    color: var(--ink-700) !important;
    line-height: 1.6 !important;
}

.chosen-container .chosen-drop {
    border: 1px solid var(--line) !important;
    border-radius: var(--r-md) !important;
    box-shadow: var(--shadow-lg) !important;
    margin-top: 4px !important;
    overflow: hidden !important;
}

.chosen-container .chosen-results li.highlighted {
    background: var(--primary-500) !important;
}

.daterangepicker {
    border: 1px solid var(--line) !important;
    border-radius: var(--r-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: 'Inter', sans-serif !important;
}

.daterangepicker td.active,
.daterangepicker td.active:hover {
    background: var(--primary-500) !important;
}

#toast-container > div {
    border-radius: var(--r-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    opacity: 1 !important;
    font-family: 'Inter', sans-serif !important;
    font-size: .85rem !important;
    padding: 15px 15px 15px 50px !important;
}

/* DataTables chrome */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: var(--surface-sunken) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--r-md) !important;
}

.dataTables_wrapper .dataTables_info {
    color: var(--ink-500) !important;
    font-size: .8rem !important;
    padding-top: 14px !important;
}

.dataTables_wrapper .top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.dataTables_wrapper .top .dataTables_filter {
    margin-left: auto;
}

table.dataTable.no-footer {
    border-bottom: 0 !important;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--ink-500);
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--ink-400);
    margin-bottom: 12px;
    display: block;
}


/* --------------------------------------------------------------------------
   Motion & accessibility
   -------------------------------------------------------------------------- */

a, button, .btn, .card, .side-nav-link, .dropdown-item {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px solid var(--primary-500) !important;
    outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }

    .card:hover,
    .topCard:hover .card,
    .btn:hover {
        transform: none !important;
    }
}


/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 767.98px) {
    .card-body { padding: 16px !important; }
    .card-header { padding: 14px 16px !important; }
    .table th, .table td { padding: 11px 13px !important; }
    .filter-panel { padding: 14px 16px !important; }
    .auth-card { padding: 30px 22px 24px !important; }
}


/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
    .leftside-menu,
    .navbar-custom,
    .footer,
    .filter-panel,
    .dataTables_wrapper .top,
    .dataTables_paginate,
    .btn {
        display: none !important;
    }

    .content-page {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
}


/* --------------------------------------------------------------------------
   Layout carry-over — rules that used to live in inline <style> blocks
   inside master.blade.php / open_link_master.blade.php
   -------------------------------------------------------------------------- */

.card {
    width: 100% !important;
}

.card-body {
    overflow-x: auto;
}

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

.table {
    width: 100% !important;
    margin: 0 !important;
}

.dataTables_wrapper {
    width: 100% !important;
    overflow-x: auto !important;
}

/* Alert variants used by the message partials */
.alert-primary {
    background: var(--primary-50) !important;
    color: var(--primary-700) !important;
    border-color: var(--primary-200) !important;
}

.alert ul {
    margin: 0;
    padding-left: 18px;
}

.alert ul li + li {
    margin-top: 4px;
}


/* --------------------------------------------------------------------------
   Final polish
   -------------------------------------------------------------------------- */

/* Bootstrap's bordered variant fights the flat modern table — flatten it */
.table-bordered > :not(caption) > * ,
.table-bordered > :not(caption) > * > * {
    border-width: 0 !important;
}

.table-bordered th {
    border-bottom: 1px solid var(--line) !important;
}

.table-bordered td {
    border-bottom: 1px solid var(--line-soft) !important;
}

/* DataTables repeats the header in <tfoot>; keep it quiet */
.table tfoot th {
    background: var(--surface-sunken) !important;
    border-top: 1px solid var(--line) !important;
    border-bottom: 0 !important;
}

.card-title {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--ink-900) !important;
    margin: 0 !important;
    letter-spacing: -0.02em !important;
}

/* Stat tiles: the class already carries its own box metrics, so inline
   width/height/radius repeats in the views stay harmless */
.avatar-title-modern {
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.35rem !important;
    flex-shrink: 0;
}

/* Numbers in stat cards */
.card-body h3 {
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.03em !important;
    color: var(--ink-900) !important;
}

/* Links */
a {
    text-decoration: none;
    transition: color .2s ease;
}

a:hover {
    color: var(--primary-600);
}

/* The open-link (public) dashboard has no sidebar — give it breathing room */
body.open-link-page {
    background: var(--surface-sunken) !important;
}

body.open-link-page > .container-fluid {
    max-width: 1600px;
    margin: 0 auto;
}
