/*
|--------------------------------------------------------------------------
| public/css/app.css
| Shared styles used by every page:
|   CSS variables, reset, body, canvas bg, layout shell,
|   sidebar, topbar, common buttons, common badges,
|   drawer shell (shared), toast, toggle switch, stepper, inp fields.
|
| Page-specific CSS (stat cards, table, filters, pagination, etc.)
| lives inside the relevant blade file's @section('page-styles').
|--------------------------------------------------------------------------
*/

/* ── CSS VARIABLES ── */
:root {
    --bg:        #F4FCFB;
    --bg2:       #E8F7F6;
    --card:      #FFFFFF;
    --border:    #C8E6E4;
    --border2:   #A8D5D2;
    --ink:       #0F2B2A;
    --ink2:      #3D6B69;
    --ink3:      #7AA8A6;
    --amber:     #18B2A8;
    --amber2:    #2ECFC6;
    --coral:     #0D9488;
    --sage:      #10B981;
    --sky:       #3B82F6;
    --rose:      #F43F5E;
    --violet:    #8B5CF6;
    --font:      'Cabinet Grotesk', sans-serif;
    --serif:     'Instrument Serif', serif;
    --mono:      'JetBrains Mono', monospace;
    --r:         12px;
    --r-sm:      8px;
    --shadow:    0 2px 12px rgba(15, 43, 42, 0.08), 0 1px 3px rgba(15, 43, 42, 0.06);
    --shadow-lg: 0 8px 40px rgba(15, 43, 42, 0.12), 0 2px 8px rgba(15, 43, 42, 0.08);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background:  var(--bg);
    color:       var(--ink);
    min-height:  100vh;
    overflow-x:  hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── CANVAS BACKGROUND ── */
#canvas-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* ── LAYOUT SHELL ── */
.layout {
    display:  flex;
    height:   100vh;
    overflow: hidden;
    position: relative;
    z-index:  1;
}

/* ── SIDEBAR ── */
#sidebar {
    width:         220px;
    background:    var(--card);
    border-right:  1.5px solid var(--border);
    display:       flex;
    flex-direction: column;
    flex-shrink:   0;
    overflow-y:    auto;
    transition:    width 0.35s cubic-bezier(.34, 1.56, .64, 1);
    position:      relative;
    z-index:       10;
}

#sidebar::after {
    content:  '';
    position: absolute;
    top: 0; right: -1px; bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--amber2) 40%, var(--amber) 60%, transparent);
    opacity: 0.4;
}

.brand {
    /* padding:      18px 16px; */
    padding:      7px 15px;
    border-bottom: 1.5px solid var(--border);
    display:      flex;
    align-items:  center;
    gap:          10px;
}

.logo-grid {
    width:    26px;
    height:   26px;
    display:  grid;
    grid-template-columns: 1fr 1fr;
    gap:      3px;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(.34, 1.56, .64, 1);
}

.logo-grid:hover { transform: rotate(90deg); }

.logo-grid span { border-radius: 3px; display: block; }

.brand-name {
    font-size:      15px;
    font-weight:    800;
    letter-spacing: -0.03em;
    white-space:    nowrap;
}
.brand-logo {
    width: 140px;
}
.short-logo { display: none; width: 32px; }
.full-logo  { display: block; }
.brand-name span { color: var(--amber); }

nav {
    flex:    1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap:     1px;
}

.nav-item {
    display:         flex;
    align-items:     center;
    gap:             10px;
    padding:         10px 12px;
    border-radius:   var(--r-sm);
    font-size:       13.5px;
    font-weight:     600;
    color:           var(--ink2);
    text-decoration: none;
    cursor:          pointer;
    border:          1.5px solid transparent;
    transition:      all 0.2s cubic-bezier(.34, 1.56, .64, 1);
    position:        relative;
    overflow:        hidden;
    white-space:     nowrap;
}

.nav-item::before {
    content:    '';
    position:   absolute;
    inset:      0;
    background: linear-gradient(135deg, rgba(24, 178, 168, 0.1), rgba(13, 148, 136, 0.05));
    opacity:    0;
    transition: opacity 0.2s;
}

.nav-item:hover {
    color:        var(--ink);
    transform:    translateX(3px);
    border-color: var(--border);
    background:   var(--bg2);
}

.nav-item:hover::before { opacity: 1; }

.nav-item.active {
    background:   linear-gradient(135deg, rgba(24, 178, 168, 0.12), rgba(13, 148, 136, 0.08));
    color:        var(--coral);
    border-color: rgba(24, 178, 168, 0.35);
    box-shadow:   3px 3px 0 rgba(24, 178, 168, 0.2);
}

.nav-item.active svg { color: var(--amber); }

.nav-badge {
    margin-left:   auto;
    background:    var(--coral);
    color:         #fff;
    font-size:     10px;
    font-weight:   800;
    border-radius: 20px;
    min-width:     20px;
    height:        20px;
    display:       flex;
    align-items:   center;
    justify-content: center;
    padding:       0 6px;
    animation:     badge-pulse 2s ease infinite;
}

@keyframes badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(24, 178, 168, 0.4); }
    50%       { box-shadow: 0 0 0 5px rgba(24, 178, 168, 0); }
}

.nav-divider { height: 1px; background: var(--border); margin: 4px 8px; }

.sidebar-footer { padding: 10px 8px; border-top: 1.5px solid var(--border); }

/* Sidebar collapse */
.sidebar-collapsed { width: 60px !important; }

.sidebar-collapsed .brand-name,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-badge { display: none !important; }

.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar-collapsed .nav-item.active::before { display: none; }
.sidebar-collapsed .full-logo  { display: none; }
.sidebar-collapsed .short-logo { display: block; }

/* Mobile sidebar overlay */
#overlay-sidebar {
    display:    none;
    position:   fixed;
    inset:      0;
    background: rgba(26, 20, 16, 0.5);
    z-index:    40;
    backdrop-filter: blur(2px);
}

#overlay-sidebar.show { display: block; }

@media (max-width: 768px) {
    #sidebar {
        position:  fixed;
        top: 0; left: 0; bottom: 0;
        z-index:   50;
        transform: translateX(-100%);
    }

    #sidebar.open { transform: translateX(0); }
    #mbtn { display: flex !important; }
    .drawer { width: 100vw; }
}

#mbtn { display: none; }

/* ── TOPBAR ── */
.topbar {
    background:    var(--card);
    border-bottom: 1.5px solid var(--border);
    padding:       10px 20px;
    display:       flex;
    align-items:   center;
    gap:           12px;
    flex-shrink:   0;
    position:      relative;
    z-index:       5;
}

.search-wrap {
    flex:      1;
    max-width: 440px;
    position:  relative;
}

.search-input {
    width:       100%;
    background:  var(--bg);
    border:      1.5px solid var(--border);
    border-radius: var(--r);
    padding:     9px 14px 9px 38px;
    font-family: var(--font);
    font-size:   13.5px;
    color:       var(--ink);
    outline:     none;
    transition:  all 0.25s cubic-bezier(.34, 1.56, .64, 1);
}

.search-input:focus {
    border-color: var(--amber);
    background:   var(--card);
    box-shadow:   0 0 0 3px rgba(24, 178, 168, 0.12), 3px 3px 0 rgba(24, 178, 168, 0.2);
    transform:    scale(1.01);
}

.search-icon {
    position:  absolute;
    left:      11px;
    top:       50%;
    transform: translateY(-50%);
    color:     var(--ink3);
}

.topbar-right {
    display:     flex;
    align-items: center;
    gap:         8px;
    margin-left: auto;
}

.icon-btn {
    width:         36px;
    height:        36px;
    border-radius: var(--r-sm);
    border:        1.5px solid var(--border);
    background:    var(--bg);
    display:       flex;
    align-items:   center;
    justify-content: center;
    cursor:        pointer;
    color:         var(--ink2);
    position:      relative;
    transition:    all 0.2s cubic-bezier(.34, 1.56, .64, 1);
}

.icon-btn:hover {
    border-color: var(--amber);
    color:        var(--amber);
    background:   rgba(24, 178, 168, 0.06);
    transform:    translateY(-2px) rotate(-5deg);
    box-shadow:   2px 4px 0 rgba(24, 178, 168, 0.2);
}

.notif-dot {
    position:      absolute;
    top:  3px;
    right: 3px;
    width:         15px;
    height:        15px;
    background:    var(--coral);
    border-radius: 50%;
    border:        2px solid var(--card);
    display:       flex;
    align-items:   center;
    justify-content: center;
    font-size:     8px;
    font-weight:   800;
    color:         #fff;
    font-family:   var(--mono);
}

.avatar {
    width:         36px;
    height:        36px;
    border-radius: var(--r-sm);
    background:    linear-gradient(135deg, var(--amber), var(--coral));
    display:       flex;
    align-items:   center;
    justify-content: center;
    font-size:     12px;
    font-weight:   800;
    color:         #fff;
    cursor:        pointer;
    border:        1.5px solid var(--border);
    transition:    transform 0.2s cubic-bezier(.34, 1.56, .64, 1), box-shadow 0.2s;
}

.avatar:hover {
    transform:  scale(1.1) rotate(5deg);
    box-shadow: 3px 3px 0 var(--amber);
}

/* ── PAGE CONTENT AREA ── */
.page { flex: 1; overflow-y: auto; padding: 22px 24px; }

/* ── PAGE HEADER ── */
.page-hdr {
    display:         flex;
    align-items:     flex-start;
    justify-content: space-between;
    gap:             14px;
    margin-bottom:   16px;
    flex-wrap:       wrap;
}

.page-title {
    font-size:      22px;
    font-weight:    800;
    letter-spacing: -0.04em;
    color:          var(--ink);
    line-height:    1.1;
}

.page-title em {
    font-family: var(--serif);
    font-style:  italic;
    color:       var(--coral);
}

.page-sub { font-size: 12.5px; color: var(--ink3); margin-top: 3px; }

/* ── BUTTONS (shared) ── */
.btn-primary-custom {
    display:       inline-flex;
    align-items:   center;
    gap:           7px;
    padding:       9px 18px;
    border-radius: var(--r-sm);
    font-family:   var(--font);
    font-size:     13.5px;
    font-weight:   700;
    cursor:        pointer;
    border:        none;
    transition:    all 0.2s cubic-bezier(.34, 1.56, .64, 1);
    position:      relative;
    overflow:      hidden;
    background:    var(--amber);
    color:         #fff;
    box-shadow:    3px 3px 0 rgba(24, 178, 168, 0.4);
}

.btn-primary-custom::after {
    content:    '';
    position:   absolute;
    inset:      0;
    background: rgba(255, 255, 255, 0.2);
    transform:  translateX(-100%);
    transition: transform 0.3s ease;
}

.btn-primary-custom:hover::after { transform: translateX(100%); }

.btn-primary-custom:hover {
    background: var(--coral);
    box-shadow: 4px 4px 0 rgba(13, 148, 136, 0.4);
    transform:  translate(-1px, -1px);
}

.btn-primary-custom:active {
    transform:  translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(24, 178, 168, 0.3);
}

.btn-ghost-custom {
    display:       inline-flex;
    align-items:   center;
    gap:           7px;
    padding:       9px 18px;
    border-radius: var(--r-sm);
    font-family:   var(--font);
    font-size:     13.5px;
    font-weight:   700;
    cursor:        pointer;
    background:    transparent;
    color:         var(--ink2);
    border:        1.5px solid var(--border2);
    box-shadow:    3px 3px 0 rgba(26, 20, 16, 0.08);
    transition:    all 0.2s cubic-bezier(.34, 1.56, .64, 1);
    position:      relative;
    overflow:      hidden;
}

.btn-ghost-custom::after {
    content:    '';
    position:   absolute;
    inset:      0;
    background: rgba(255, 255, 255, 0.2);
    transform:  translateX(-100%);
    transition: transform 0.3s ease;
}

.btn-ghost-custom:hover::after  { transform: translateX(100%); }

.btn-ghost-custom:hover {
    border-color: var(--ink2);
    color:        var(--ink);
    transform:    translate(-1px, -1px);
    box-shadow:   4px 4px 0 rgba(26, 20, 16, 0.12);
}

/* ── BADGES (shared across pages) ── */
.badge-custom {
    display:       inline-flex;
    align-items:   center;
    gap:           5px;
    padding:       3px 9px;
    border-radius: 20px;
    font-size:     11.5px;
    font-weight:   700;
    transition:    transform 0.2s cubic-bezier(.34, 1.56, .64, 1);
}

.badge-custom:hover { transform: scale(1.08); }

.badge-custom::before {
    content:       '';
    width:         5px;
    height:        5px;
    border-radius: 50%;
    flex-shrink:   0;
}

.b-active   { background: rgba(16, 185, 129, 0.1);  color: #059669; border: 1px solid rgba(16, 185, 129, 0.25); }
.b-active::before   { background: #10B981; box-shadow: 0 0 4px #10B981; }

.b-pending  { background: rgba(24, 178, 168, 0.1);  color: #0D9488; border: 1.5px dashed rgba(24, 178, 168, 0.4); }
.b-pending::before  { background: var(--amber); }

.b-suspended { background: rgba(244, 63, 94, 0.08); color: #E11D48; border: 1px solid rgba(244, 63, 94, 0.2); }
.b-suspended::before { background: var(--rose); }

/* ── SHARED FORM INPUTS ── */
label {
    display:        block;
    font-size:      12px;
    font-weight:    700;
    color:          var(--ink2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom:  6px;
}

.inp {
    width:         100%;
    background:    var(--bg);
    border:        1.5px solid var(--border);
    border-radius: var(--r-sm);
    padding:       10px 12px;
    font-family:   var(--font);
    font-size:     13.5px;
    color:         var(--ink);
    outline:       none;
    transition:    all 0.2s cubic-bezier(.34, 1.56, .64, 1);
    box-shadow:    2px 2px 0 rgba(26, 20, 16, 0.04);
}

.inp:focus {
    border-color: var(--amber);
    background:   var(--card);
    box-shadow:   2px 2px 0 rgba(24, 178, 168, 0.2), 0 0 0 3px rgba(245, 158, 11, 0.1);
    transform:    translateY(-1px);
}

.inp.valid { border-color: var(--sage); box-shadow: 2px 2px 0 rgba(16, 185, 129, 0.2); }

.inp.error {
    border-color: var(--rose);
    box-shadow:   2px 2px 0 rgba(244, 63, 94, 0.2);
    animation:    shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-4px); }
    75%       { transform: translateX(4px); }
}

.inp-wrap { position: relative; }

.inp-icon {
    position:  absolute;
    right:     10px;
    top:       50%;
    transform: translateY(-50%);
    font-size: 14px;
    transition: all 0.2s;
}

select.inp { cursor: pointer; }

/* Select wrapper (filter dropdowns) */
.select-wrap { position: relative; }

.filter-select {
    appearance:    none;
    background:    var(--card);
    border:        1.5px solid var(--border);
    border-radius: var(--r-sm);
    padding:       8px 28px 8px 11px;
    font-family:   var(--font);
    font-size:     12.5px;
    color:         var(--ink2);
    cursor:        pointer;
    outline:       none;
    box-shadow:    2px 2px 0 rgba(26, 20, 16, 0.05);
    transition:    all 0.2s cubic-bezier(.34, 1.56, .64, 1);
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--amber);
    color:        var(--ink);
    box-shadow:   2px 2px 0 rgba(24, 178, 168, 0.2);
}

.select-wrap svg {
    position:       absolute;
    right:          8px;
    top:            50%;
    transform:      translateY(-50%);
    pointer-events: none;
    color:          var(--ink3);
}

/* ── DRAWER SHELL (shared — content injected per page) ── */
.overlay {
    position:   fixed;
    inset:      0;
    background: rgba(26, 20, 16, 0.4);
    backdrop-filter: blur(4px);
    z-index:    100;
    opacity:    0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.show { opacity: 1; pointer-events: all; }

.drawer {
    position:   fixed;
    top: 0; right: 0; bottom: 0;
    width:      480px;
    max-width:  100vw;
    background: var(--card);
    border-left: 1.5px solid var(--border);
    z-index:    101;
    display:    flex;
    flex-direction: column;
    transform:  translateX(100%);
    transition: transform 0.4s cubic-bezier(.34, 1.56, .64, 1);
    box-shadow: -8px 0 40px rgba(26, 20, 16, 0.12);
}

.drawer.open { transform: translateX(0); }

.drawer-header {
    padding:         20px 24px;
    border-bottom:   1.5px solid var(--border);
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    background:      var(--bg2);
}

.drawer-title {
    font-size:      17px;
    font-weight:    800;
    letter-spacing: -0.03em;
}

.drawer-title em { font-family: var(--serif); font-style: italic; color: var(--amber); }

.close-btn {
    width:         32px;
    height:        32px;
    border-radius: 6px;
    border:        1.5px solid var(--border);
    background:    var(--card);
    cursor:        pointer;
    color:         var(--ink2);
    display:       flex;
    align-items:   center;
    justify-content: center;
    transition:    all 0.2s cubic-bezier(.34, 1.56, .64, 1);
}

.close-btn:hover { background: var(--rose); border-color: var(--rose); color: #fff; transform: rotate(90deg); }

/* Stepper */
.stepper {
    padding:     18px 24px;
    border-bottom: 1.5px solid var(--border);
    display:     flex;
    align-items: center;
    gap:         0;
}

.step { display: flex; align-items: center; gap: 8px; flex: 1; }

.step-circle {
    width:         28px;
    height:        28px;
    border-radius: 50%;
    border:        2px solid var(--border2);
    background:    var(--bg);
    display:       flex;
    align-items:   center;
    justify-content: center;
    font-size:     11px;
    font-weight:   800;
    color:         var(--ink3);
    transition:    all 0.3s cubic-bezier(.34, 1.56, .64, 1);
    flex-shrink:   0;
}

.step.done   .step-circle { background: var(--sage);  border-color: var(--sage);  color: #fff; transform: scale(1.1); }
.step.active .step-circle { background: var(--amber); border-color: var(--amber); color: #fff; transform: scale(1.15); box-shadow: 0 0 0 4px rgba(24, 178, 168, 0.2); }

.step-label { font-size: 11px; font-weight: 700; color: var(--ink3); white-space: nowrap; transition: color 0.2s; }
.step.active .step-label { color: var(--amber); }
.step.done   .step-label { color: var(--sage);  }

.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 4px; border-radius: 2px; transition: background 0.3s; }
.step-line.done { background: var(--sage); }

.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px; }

.drawer-footer {
    padding:         16px 24px;
    border-top:      1.5px solid var(--border);
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    background:      var(--bg2);
    gap:             10px;
}

/* ── TOGGLE SWITCH (shared — used in drawer settings panel) ── */
.toggle {
    width:         40px;
    height:        22px;
    background:    var(--border2);
    border-radius: 11px;
    cursor:        pointer;
    position:      relative;
    transition:    background 0.2s;
    flex-shrink:   0;
}

.toggle::after {
    content:       '';
    position:      absolute;
    top:  3px;
    left: 3px;
    width:         16px;
    height:        16px;
    border-radius: 50%;
    background:    #fff;
    transition:    transform 0.2s cubic-bezier(.34, 1.56, .64, 1);
    box-shadow:    0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle.on { background: var(--amber); }
.toggle.on::after { transform: translateX(18px); }

/* ── TOAST ── */
#toast-container {
    position:       fixed;
    top:            20px;
    right:          20px;
    z-index:        9999;
    display:        flex;
    flex-direction: column;
    gap:            8px;
}

.toast-custom {
    background:    var(--card);
    border:        1.5px solid var(--border);
    border-radius: var(--r);
    padding:       12px 16px;
    display:       flex;
    align-items:   center;
    gap:           10px;
    font-size:     13.5px;
    font-weight:   600;
    box-shadow:    var(--shadow-lg), 4px 4px 0 rgba(26, 20, 16, 0.08);
    animation:     toast-in 0.4s cubic-bezier(.34, 1.56, .64, 1);
    min-width:     260px;
    max-width:     320px;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(60px) scale(0.8); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.toast-out { animation: toast-out 0.3s ease forwards; }

@keyframes toast-out {
    to { opacity: 0; transform: translateX(60px) scale(0.8); }
}

.toast-icon {
    width:         28px;
    height:        28px;
    border-radius: 6px;
    display:       flex;
    align-items:   center;
    justify-content: center;
    flex-shrink:   0;
    font-size:     14px;
}

.toast-custom.success .toast-icon { background: rgba(16, 185, 129, 0.1);  color: var(--sage); }
.toast-custom.error   .toast-icon { background: rgba(244, 63, 94, 0.1);   color: var(--rose); }
.toast-custom.info    .toast-icon { background: rgba(59, 130, 246, 0.1);  color: var(--sky);  }

/* ── SKELETON LOADER (shared utility) ── */
.skeleton {
    background:      linear-gradient(90deg, var(--bg2) 25%, var(--bg) 50%, var(--bg2) 75%);
    background-size: 200% 100%;
    animation:       shimmer 1.4s infinite;
    border-radius:   4px;
}

@keyframes shimmer {
    0%   { background-position:  200% 0; }
    100% { background-position: -200% 0; }
}