/* ==========================================================================
   DelltonPlus Admin Shell - Sneat-inspired layout
   Used by MainLayout (admin-wrapper > admin-sidebar + admin-header + content)
   ========================================================================== */

:root {
    --op-sidebar-bg: #2b2c40;
    --op-sidebar-bg-hover: #3a3b5a;
    --op-sidebar-text: #c7c8d6;
    --op-sidebar-text-muted: #8589a6;
    --op-sidebar-active-bg: linear-gradient(72.47deg, #696cff 22.16%, rgba(105, 108, 255, 0.7) 76.47%);
    --op-sidebar-active-text: #fff;
    --op-sidebar-width: 260px;
    --op-sidebar-width-collapsed: 70px;

    --op-header-bg: #ffffff;
    --op-header-shadow: 0 2px 6px 0 rgba(67, 89, 113, 0.12);
    --op-header-height: 64px;

    --op-content-bg: #f5f5f9;
    --op-text: #566a7f;
    --op-text-strong: #384551;
    --op-primary: #696cff;
    --op-primary-hover: #5f61e6;
    --op-border: #d9dee3;
    --op-card-bg: #ffffff;
    --op-card-shadow: 0 2px 6px 0 rgba(67, 89, 113, 0.12);
}

/* Body baseline (only on admin pages, scoped via wrapper) */
.admin-wrapper {
    min-height: 100vh;
    display: flex;
    background: var(--op-content-bg);
    color: var(--op-text);
    font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.47;
}

/* ============================== Sidebar ============================== */
.admin-sidebar {
    width: var(--op-sidebar-width);
    background: var(--op-sidebar-bg);
    color: var(--op-sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    z-index: 1030;
}

.admin-sidebar.collapsed { width: var(--op-sidebar-width-collapsed); }

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.3px;
    text-decoration: none;
}

.admin-sidebar-brand .brand-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: var(--op-sidebar-active-bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
    flex-shrink: 0;
}

.admin-sidebar.collapsed .admin-sidebar-brand .brand-text { display: none; }

.admin-sidebar-toggle {
    background: rgba(255,255,255,0.06);
    border: none;
    color: var(--op-sidebar-text);
    width: 28px; height: 28px;
    border-radius: 6px;
    margin-left: auto;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-sidebar-toggle:hover { background: rgba(255,255,255,0.12); color: #fff; }
.admin-sidebar.collapsed .admin-sidebar-toggle { display: none; }

.admin-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.admin-sidebar-nav::-webkit-scrollbar { width: 6px; }
.admin-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.admin-nav-section {
    padding: 14px 20px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--op-sidebar-text-muted);
}

.admin-sidebar.collapsed .admin-nav-section { text-align: center; padding: 14px 0 6px; font-size: 0; }
.admin-sidebar.collapsed .admin-nav-section::before { content: '•'; font-size: 0.85rem; color: var(--op-sidebar-text-muted); }

.admin-nav-item { padding: 1px 12px; }

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: 8px;
    color: var(--op-sidebar-text);
    font-size: 0.9375rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-nav-link:hover {
    background: var(--op-sidebar-bg-hover);
    color: #fff;
}

.admin-nav-link.active {
    background: var(--op-sidebar-active-bg);
    color: var(--op-sidebar-active-text);
    box-shadow: 0 2px 6px 0 rgba(105, 108, 255, 0.3);
}

.admin-nav-link > i,
.admin-nav-link > .nav-icon {
    font-size: 1.15rem;
    width: 20px;
    flex-shrink: 0;
    display: inline-flex;
    justify-content: center;
}

.admin-sidebar.collapsed .admin-nav-link { justify-content: center; padding: 10px; }
.admin-sidebar.collapsed .admin-nav-link .nav-text { display: none; }

.admin-nav-children { margin-left: 14px; padding-left: 12px; border-left: 1px dashed rgba(255,255,255,0.12); }
.admin-sidebar.collapsed .admin-nav-children { display: none; }

/* ============================== Sidebar footer (sticky Sign Out) ====== */
.admin-sidebar-footer {
    flex-shrink: 0;
    padding: 10px 0 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: var(--op-sidebar-bg);
}

.admin-nav-link.admin-nav-link--signout {
    color: #ff8a80;
}

.admin-nav-link.admin-nav-link--signout:hover {
    background: rgba(255, 62, 29, 0.12);
    color: #ff5350;
}

.admin-sidebar.collapsed .admin-sidebar-footer { padding: 8px 0; }

/* ============================== Main column ============================== */
.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================== Header ============================== */
.admin-header {
    height: var(--op-header-height);
    background: var(--op-header-bg);
    box-shadow: var(--op-header-shadow);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.admin-header-toggle {
    background: transparent;
    border: none;
    color: var(--op-text);
    font-size: 1.4rem;
    width: 38px; height: 38px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.admin-header-toggle:hover { background: rgba(105,108,255,0.08); color: var(--op-primary); }

.admin-header-search {
    flex: 1;
    max-width: 420px;
    position: relative;
}

.admin-header-search input {
    width: 100%;
    height: 38px;
    border: 1px solid var(--op-border);
    border-radius: 8px;
    padding: 0 14px 0 38px;
    background: #f5f6fa;
    font-size: 0.9rem;
    color: var(--op-text-strong);
    transition: border-color 0.15s, background 0.15s;
}

.admin-header-search input:focus {
    outline: none;
    border-color: var(--op-primary);
    background: #fff;
}

.admin-header-search .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--op-text); font-size: 1rem; pointer-events: none;
}

.admin-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.admin-header-icon-btn {
    width: 38px; height: 38px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--op-text);
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    position: relative;
}

.admin-header-icon-btn:hover { background: rgba(105,108,255,0.08); color: var(--op-primary); }

.admin-header-icon-btn .badge-dot {
    position: absolute;
    top: 8px; right: 8px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ff3e1d;
    border: 2px solid #fff;
}

.admin-header-user {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: var(--op-text-strong);
}

.admin-header-user:hover { background: rgba(105,108,255,0.08); color: var(--op-text-strong); }

.admin-header-user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--op-sidebar-active-bg);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 0.85rem;
}

.admin-header-user-info { display: flex; flex-direction: column; line-height: 1.15; }
.admin-header-user-info .name { font-size: 0.875rem; font-weight: 600; color: var(--op-text-strong); }
.admin-header-user-info .role { font-size: 0.75rem; color: var(--op-text); }

@media (max-width: 768px) {
    .admin-header-search { display: none; }
    .admin-header-user-info { display: none; }
}

/* ============================== Content ============================== */
.admin-content {
    flex: 1;
    padding: 24px;
    background: var(--op-content-bg);
}

.admin-card {
    background: var(--op-card-bg);
    border-radius: 8px;
    box-shadow: var(--op-card-shadow);
    padding: 20px;
    margin-bottom: 16px;
}

/* ============================== Sidebar quick-search ============================== */
.admin-sidebar-search {
    position: relative;
    margin: 8px 14px 4px;
}

.admin-sidebar-search input {
    width: 100%;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.06);
    color: #fff;
    padding: 0 30px 0 32px;
    font-size: 0.85rem;
    transition: background 0.15s, border-color 0.15s;
}

.admin-sidebar-search input::placeholder { color: var(--op-sidebar-text-muted); }

.admin-sidebar-search input:focus {
    outline: none;
    background: rgba(255,255,255,0.10);
    border-color: rgba(105,108,255,0.6);
}

.admin-sidebar-search > .bi-search {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--op-sidebar-text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.admin-sidebar-search-clear {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
    width: 24px; height: 24px;
    background: transparent;
    border: none;
    color: var(--op-sidebar-text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
}

.admin-sidebar-search-clear:hover { background: rgba(255,255,255,0.10); color: #fff; }

.admin-sidebar.collapsed .admin-sidebar-search { display: none; }

/* ============================== Sidebar group buttons / caret ============================== */
.admin-nav-link--group {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.admin-nav-link--group .nav-text { flex: 1; }

.admin-nav-link.active-branch:not(.active) {
    color: #fff;
    background: rgba(255,255,255,0.04);
}

.nav-caret {
    margin-left: auto;
    font-size: 0.8rem !important;
    transition: transform 0.18s ease;
    width: auto !important;
    opacity: 0.75;
}

.nav-caret.open { transform: rotate(180deg); }

.admin-sidebar.collapsed .nav-caret { display: none; }

.admin-nav-link--placeholder {
    opacity: 0.65;
    cursor: default;
}

.admin-nav-link--loading {
    opacity: 0.7;
    cursor: progress;
}

.admin-nav-link--overview {
    font-size: 0.85rem;
    opacity: 0.85;
}

.admin-nav-empty {
    padding: 14px 20px;
    color: var(--op-sidebar-text-muted);
    font-size: 0.85rem;
    display: flex; align-items: center; gap: 8px;
}

/* ============================== Dashboard ============================== */
.dash-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.dash-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--op-text-strong);
}

.dash-header .dash-sub { color: var(--op-text); font-size: 0.9rem; }

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.dash-card {
    background: var(--op-card-bg);
    border-radius: 12px;
    box-shadow: var(--op-card-shadow);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dash-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px 0 rgba(67, 89, 113, 0.18);
}

.dash-card .dash-card-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    background: var(--op-sidebar-active-bg);
}

.dash-card.tone-info    .dash-card-icon { background: linear-gradient(72deg, #03c3ec, #03c3ec99); }
.dash-card.tone-success .dash-card-icon { background: linear-gradient(72deg, #71dd37, #71dd3799); }
.dash-card.tone-warning .dash-card-icon { background: linear-gradient(72deg, #ffab00, #ffab0099); }
.dash-card.tone-danger  .dash-card-icon { background: linear-gradient(72deg, #ff3e1d, #ff3e1d99); }

.dash-card-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--op-text);
}

.dash-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--op-text-strong);
    line-height: 1.1;
}

.dash-card-value.dim { color: var(--op-text); font-size: 1.1rem; font-weight: 500; }

.dash-card-link {
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--op-primary);
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
}

.dash-card-link:hover { text-decoration: underline; }

.dash-section {
    margin-top: 28px;
}

.dash-section h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--op-text-strong);
    margin: 0 0 12px;
}

.dash-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.dash-quick-tile {
    background: var(--op-card-bg);
    border: 1px solid var(--op-border);
    border-radius: 10px;
    padding: 14px;
    display: flex; align-items: center; gap: 12px;
    text-decoration: none;
    color: var(--op-text-strong);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.dash-quick-tile:hover {
    border-color: var(--op-primary);
    color: var(--op-primary);
    background: rgba(105,108,255,0.04);
}

.dash-quick-tile i {
    font-size: 1.2rem;
    width: 32px; height: 32px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(105,108,255,0.10);
    color: var(--op-primary);
}

.dash-alert {
    background: #fff5f5;
    color: #b42318;
    border: 1px solid #fecdca;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    display: flex; align-items: center; gap: 8px;
}

.pagination-shell {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid var(--op-border);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    overflow: visible;
}

.filter-shell {
    position: relative;
    z-index: 2;
    overflow: visible;
}

.pagination-meta {
    font-size: 0.85rem;
    color: var(--op-text-muted);
    font-weight: 600;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================== EntityAutoComplete ============================== */
.op-autocomplete {
    position: relative;
    width: 100%;
    z-index: 2;
}

.op-autocomplete-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.op-autocomplete-icon {
    position: absolute;
    left: 10px;
    color: var(--op-text);
    pointer-events: none;
    font-size: 0.85rem;
    opacity: 0.6;
}

.op-autocomplete-input.form-control {
    padding-left: 30px;
    padding-right: 30px;
}

.op-autocomplete-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--op-text);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
}

.op-autocomplete-clear:hover {
    background: rgba(67, 89, 113, 0.08);
    color: var(--op-text-strong);
}

.op-autocomplete-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 3000;
    background: #fff;
    border: 1px solid var(--op-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(67, 89, 113, 0.18);
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
}

.op-autocomplete-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    background: transparent;
    border: 0;
    padding: 7px 10px;
    border-radius: 6px;
    text-align: left;
    color: var(--op-text-strong);
    cursor: pointer;
    transition: background 0.12s;
}

.op-autocomplete-option:hover,
.op-autocomplete-option.highlight {
    background: rgba(105, 108, 255, 0.08);
}

.op-autocomplete-primary {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
}

.op-autocomplete-secondary {
    font-size: 0.75rem;
    color: var(--op-text);
    opacity: 0.8;
    margin-top: 2px;
}

.op-autocomplete-empty {
    padding: 10px;
    text-align: center;
    color: var(--op-text);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ============================== Mobile sidebar overlay ============================== */
@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .admin-sidebar.mobile-open { transform: translateX(0); }

    .admin-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1029;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }

    .admin-sidebar-overlay.show { opacity: 1; pointer-events: auto; }
}

