:root {
    --primary: #a47551;
    --primary-light: #f5ece5;
    --secondary: #22C55E;
    --danger: #EF4444;
    --warning: #F59E0B;
    --bg: #F9FAFB;
    --surface: #ffffff;
    --border: #E5E7EB;
    --text: #a47551;
    --muted: #6B7280;
    --sidebar-w: 256px;
    --topbar-h: 64px;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .10);
}

[data-theme="dark"] {
    --bg: #111827;
    --surface: #1F2937;
    --border: #374151;
    --text: #F9FAFB;
    --muted: #9CA3AF;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

/* LAYOUT */
#admin-wrapper {
    display: flex;
    min-height: 100vh;
}

#sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    overflow-x: hidden;
}

.sidebar-collapsed #sidebar {
    width: 64px;
}

#content {
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    width: calc(100% - var(--sidebar-w));
    min-height: 100vh;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-collapsed #content {
    margin-left: 64px;
    width: calc(100% - 64px);
}

#topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-w);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    justify-content: space-between;
    z-index: 999;
    transition: left .3s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-collapsed #topbar {
    left: 64px;
}

/* SIDEBAR */
.sidebar-logo {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -.3px;
    color: var(--primary);
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-logo span {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity .2s;
}

.sidebar-collapsed .sidebar-logo span {
    opacity: 0;
    pointer-events: none;
}

.sidebar-nav {
    padding: 12px 10px;
    flex: 1;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    padding: 14px 10px 6px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity .2s;
}

.sidebar-collapsed .nav-section-label {
    opacity: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    transition: all .2s;
    margin-bottom: 2px;
    white-space: nowrap;
}

.nav-item i {
    font-size: 17px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.nav-item span {
    overflow: hidden;
    transition: opacity .2s;
}

.sidebar-collapsed .nav-item span {
    opacity: 0;
    pointer-events: none;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: linear-gradient(to right, var(--primary-light), #fff) !important;
    color: var(--primary);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-item.active i {
    color: var(--primary);
}

.sidebar-collapsed .nav-item {
    padding: 10px;
    justify-content: center;
}

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

/* TOPBAR */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.toggle-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: .2s;
}

.toggle-btn:hover {
    background: var(--bg);
    color: var(--text);
}

/* GLOBAL SEARCH */
.global-search {
    position: relative;
}

.global-search input {
    width: 280px;
    height: 38px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 0 12px 0 38px;
    background: var(--bg);
    font-size: 13px;
    outline: none;
    transition: .2s;
    color: var(--text);
}

.global-search input:focus {
    border-color: var(--primary);
    width: 340px;
    box-shadow: 0 0 0 3px rgba(164, 117, 81, .1);
}

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

.search-kbd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--border);
    color: var(--muted);
    border-radius: 4px;
    font-size: 10px;
    padding: 2px 5px;
    font-family: monospace;
}

.search-dropdown {
    display: none;
    position: absolute;
    top: 46px;
    left: 0;
    width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 9999;
    overflow: hidden;
}

.search-dropdown-header {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text);
    transition: .15s;
    cursor: pointer;
}

.search-result-item:hover {
    background: var(--bg);
}

.search-result-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-result-label {
    font-size: 13px;
    font-weight: 600;
}

.search-result-sub {
    font-size: 11px;
    color: var(--muted);
}

.search-result-type {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: auto;
    text-transform: uppercase;
}

/* NOTIFICATION */
.notif-btn {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    background: var(--danger);
    color: #fff;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--surface);
}

.notif-dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 9999;
}

.notif-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-dropdown-header h6 {
    font-weight: 700;
    font-size: 14px;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: .15s;
}

.notif-item:hover {
    background: var(--bg);
}

.notif-item.unread {
    background: var(--primary-light);
}

.notif-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
}

.notif-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.notif-time {
    font-size: 10px;
    color: var(--muted);
    margin-top: 4px;
}

.notif-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.notif-footer a {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* USER MENU */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

/* PAGE */
.page-content {
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.3px;
    color: var(--primary);
}

.page-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-top: 3px;
}

/* CARDS */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-body {
    padding: 20px;
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary);
}

/* STAT CARDS */
.stat-card {
    display: flex;
    gap: 16px;
    align-items: center;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08) !important;
}

.stat-card-hover:hover .stat-icon {
    transform: scale(1.1);
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 2px;
}

.stat-change {
    font-size: 12px;
    margin-top: 4px;
}

.stat-change.up {
    color: var(--secondary);
}

.stat-change.down {
    color: var(--danger);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: #8e6241;
    box-shadow: 0 4px 12px rgba(164, 117, 81, .3);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-danger {
    background: #FEF2F2;
    color: var(--danger);
    border-color: #FECACA;
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-success {
    background: #F0FDF4;
    color: var(--secondary);
    border-color: #BBF7D0;
}

.btn-success:hover {
    background: var(--secondary);
    color: #fff;
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-icon {
    width: 38px;
    padding: 0;
    justify-content: center;
}

.btn-icon.btn-sm {
    width: 32px;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.badge-success {
    background: #F0FDF4;
    color: #15803D;
}

.badge-danger {
    background: #FEF2F2;
    color: #DC2626;
}

.badge-warning {
    background: #FFFBEB;
    color: #D97706;
}

.badge-info {
    background: #EFF6FF;
    color: #2563EB;
}

.badge-gray {
    background: #F3F4F6;
    color: #6B7280;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

/* FORMS */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #374151;
    margin-bottom: 6px;
}

.form-label .req {
    color: var(--danger);
}

.form-control {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: .2s;
}

.form-control:hover {
    border-color: #D1D5DB;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(164, 117, 81, .1);
}

textarea.form-control {
    height: auto;
    padding: 12px 14px;
    resize: vertical;
}

.form-hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 5px;
}

.slug-preview {
    margin-top: 6px;
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 12px;
    color: var(--muted);
}

.slug-preview code {
    color: var(--primary);
}

/* RADIO TOGGLE */
.radio-group {
    display: flex;
    gap: 8px;
}

.radio-pill input {
    display: none;
}

.radio-pill-label {
    display: inline-block;
    padding: 7px 18px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: .2s;
}

.radio-pill input:checked+.radio-pill-label {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* UPLOAD ZONE */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: .2s;
    background: var(--bg);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone i {
    font-size: 36px;
    color: var(--muted);
    opacity: .4;
    display: block;
    margin-bottom: 10px;
}

.upload-zone-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.upload-zone-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

/* TABLES */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 800px;
}

.data-table thead tr {
    border-bottom: 1px solid var(--border);
}

.data-table thead th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: .15s;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg);
}

.data-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
}

.tbl-action {
    display: inline-flex;
    gap: 4px;
}

.tbl-btn {
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: .2s;
}

.tbl-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.tbl-btn.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #FEF2F2;
}

/* FILTER BAR */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-search {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.filter-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
}

.filter-search input {
    padding-left: 36px;
    height: 38px;
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 13px;
    outline: none;
    color: var(--text);
    transition: .2s;
}

.filter-search input:focus {
    border-color: var(--primary);
}

.filter-select {
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: .2s;
}

.filter-select:focus {
    border-color: var(--primary);
}

/* MODALS */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .15);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 14px 20px;
}

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

.toast-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    font-size: 13px;
    animation: toastIn .35s cubic-bezier(.34, 1.56, .64, 1);
}

.toast-success {
    background: #111827;
    color: #fff;
}

.toast-danger {
    background: var(--danger);
    color: #fff;
}

.toast-warning {
    background: var(--warning);
    color: #fff;
}

.toast-icon {
    font-size: 17px;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    opacity: .7;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* SKELETON LOADING */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

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

    100% {
        background-position: -200% 0;
    }
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.empty-state i {
    font-size: 56px;
    opacity: .2;
    display: block;
    margin-bottom: 16px;
}

.empty-state h6 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13px;
}

/* UTILS */
.cursor-pointer {
    cursor: pointer;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.mono {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.text-muted {
    color: var(--muted) !important;
}

.text-primary {
    color: var(--primary) !important;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }

    .sidebar-open #sidebar {
        transform: translateX(0);
    }

    #content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    #topbar {
        left: 0 !important;
        padding: 0 16px;
    }

    .global-search input {
        width: 160px;
    }

    .global-search input:focus {
        width: 200px;
    }

    .page-content {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 999;
    }

    .sidebar-open .sidebar-backdrop {
        display: block;
    }

    /* TOPBAR MOBILE REFINEMENTS */
    .search-kbd {
        display: none;
    }

    .topbar-user-info {
        display: none;
    }

    .notif-dropdown {
        width: calc(100vw - 32px);
        right: -80px;
        position: fixed;
        top: 60px;
        margin: 0 16px;
    }

    .global-search input {
        width: 140px;
    }

    .global-search input:focus {
        width: 180px;
    }
}

@media (max-width: 480px) {
    #topbar {
        padding: 0 12px;
    }

    .global-search input {
        width: 38px;
        padding-left: 0;
        padding-right: 0;
        text-indent: -999px;
        border-color: transparent;
        background: transparent;
    }

    .global-search input:focus {
        width: calc(100vw - 160px);
        text-indent: 0;
        padding-left: 36px;
        background: var(--bg);
        border-color: var(--border);
    }
    
    .global-search .search-icon {
        left: 10px;
        pointer-events: none;
    }

    .notif-dropdown {
        right: -60px;
    }
}