/**
 * AssetBack Protocol - Global Styles
 * Version: 3.0
 * Complete consolidated stylesheet
 */

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

/* ==================== CSS VARIABLES ==================== */
:root {
    --bg: #0a0c14;
    --bg-secondary: #11131e;
    --surface: #151824;
    --surface-hover: #1c1f2e;
    --surface-elevated: #1e2134;
    --border: #252838;
    --border-light: #2e3144;
    --text: #ffffff;
    --text-secondary: #b4b8c5;
    --text-muted: #6b7084;
    --primary: #5b7cff;
    --primary-hover: #7b95ff;
    --primary-light: rgba(91, 124, 255, 0.12);
    --primary-glow: rgba(91, 124, 255, 0.25);
    --success: #2dd4bf;
    --success-bg: rgba(45, 212, 191, 0.12);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.12);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #f0f2f5;
    --bg-secondary: #f8f9fb;
    --surface: #ffffff;
    --surface-hover: #f4f6f9;
    --surface-elevated: #ffffff;
    --border: #e2e5ea;
    --border-light: #eef0f3;
    --text: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --primary: #3b5de7;
    --primary-hover: #2a4bd5;
    --primary-light: rgba(59, 93, 231, 0.08);
    --primary-glow: rgba(59, 93, 231, 0.15);
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info: #2563eb;
    --info-bg: #eff6ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
}

/* ==================== BASE ==================== */
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 700; line-height: 1.3; }
h1 { font-size: 26px; } h2 { font-size: 22px; } h3 { font-size: 17px; } h4 { font-size: 15px; }
small { font-size: 12px; color: var(--text-muted); }

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }

/* ==================== BUTTONS ==================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 22px; border-radius: var(--radius); font-size: 14px; font-weight: 600; border: none; cursor: pointer; transition: var(--transition); text-decoration: none; line-height: 1.4; white-space: nowrap; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px var(--primary-glow); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-outline-primary { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline-primary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-success { background: var(--success); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 30px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control { width: 100%; padding: 11px 14px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text); background: var(--bg); transition: var(--transition); font-family: inherit; outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); background: var(--surface); }
.form-control.error { border-color: var(--danger); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; padding-right: 40px; cursor: pointer; }
.required { color: var(--danger); }
.error-message { color: var(--danger); font-size: 12px; margin-top: 5px; font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }

/* ==================== ALERTS ==================== */
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; line-height: 1.5; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--success-bg); border: 1px solid var(--success); color: var(--success); }
.alert-danger { background: var(--danger-bg); border: 1px solid var(--danger); color: var(--danger); }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning); color: var(--warning); }
.alert-info { background: var(--info-bg); border: 1px solid var(--info); color: var(--info); }

/* ==================== BADGES ==================== */
.badge { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; gap: 5px; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-secondary { background: var(--surface-hover); color: var(--text-muted); }

/* ==================== TABLES ==================== */
.table-responsive { overflow-x: auto; border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.table th { text-align: left; padding: 14px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); background: var(--surface-hover); border-bottom: 2px solid var(--border); white-space: nowrap; font-weight: 700; }
.table td { padding: 14px 16px; font-size: 13px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-hover); }

/* ==================== PAGINATION ==================== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.page-link { display: inline-flex; align-items: center; justify-content: center; padding: 9px 15px; border-radius: var(--radius); text-decoration: none; font-size: 13px; font-weight: 600; color: var(--text-secondary); background: var(--surface); border: 2px solid var(--border); transition: var(--transition); min-width: 40px; }
.page-link:hover { background: var(--surface-hover); border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ==================== FILTERS ==================== */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.filter-chip { padding: 8px 18px; border-radius: 24px; font-size: 13px; font-weight: 600; text-decoration: none; background: var(--surface); color: var(--text-muted); transition: var(--transition); border: 2px solid transparent; }
.filter-chip:hover { border-color: var(--border); color: var(--text); text-decoration: none; }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ==================== CARDS ==================== */
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.card-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 16px; margin: 0; }

/* ==================== EMPTY STATE ==================== */
.empty-state { text-align: center; padding: 70px 20px; }
.empty-icon { font-size: 52px; margin-bottom: 16px; display: block; opacity: 0.5; }
.empty-state h3 { margin-bottom: 8px; color: var(--text); }
.empty-state p { color: var(--text-muted); margin-bottom: 24px; }

/* ==================== SIDEBAR ==================== */
.sidebar { width: 270px; min-width: 270px; background: var(--surface); color: var(--text); min-height: 100vh; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; display: flex; flex-direction: column; overflow-y: auto; transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); border-right: 1px solid var(--border); }
.sidebar-close { display: none; position: absolute; top: 16px; right: 16px; background: var(--surface-hover); border: none; color: var(--text); cursor: pointer; padding: 8px; border-radius: var(--radius-sm); z-index: 5; transition: var(--transition); }
.sidebar-close:hover { background: var(--danger-bg); color: var(--danger); }
.sidebar-brand { padding: 28px 22px; border-bottom: 1px solid var(--border); text-align: center; }
.sidebar-brand .brand-logo { width: 48px; height: 48px; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); border-radius: 14px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: #fff; box-shadow: 0 4px 12px var(--primary-glow); }
.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-nav .nav-section { padding: 10px 22px 5px; font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); font-weight: 700; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav ul li { margin: 2px 12px; }
.sidebar-nav ul li a { display: flex; align-items: center; padding: 11px 16px; color: var(--text-secondary); text-decoration: none; border-radius: var(--radius); font-size: 13px; font-weight: 500; transition: var(--transition); gap: 10px; }
.sidebar-nav ul li a svg { flex-shrink: 0; }
.sidebar-nav ul li a .badge-count { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; padding: 3px 8px; border-radius: 12px; font-weight: 700; min-width: 22px; text-align: center; }
.sidebar-nav ul li a:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-nav ul li a.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.sidebar-user { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.sidebar-user .user-avatar { width: 38px; height: 38px; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; color: #fff; flex-shrink: 0; }
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .logout-btn { color: var(--text-muted); text-decoration: none; font-size: 16px; padding: 6px 8px; border-radius: var(--radius-sm); transition: var(--transition); display: flex; align-items: center; }
.sidebar-user .logout-btn:hover { color: var(--danger); background: var(--danger-bg); }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 99; backdrop-filter: blur(4px); }
.sidebar-overlay.active { display: block; }

/* ==================== LOGO & AVATAR IMAGES ==================== */
.brand-logo-img { max-height: 44px; max-width: 160px; object-fit: contain; margin: 0 auto 10px; }
.user-avatar-img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-sm-img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }

/* ==================== DUAL-MODE LOGO ==================== */
.logo-dark { display: none; }
.logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: block; }

/* ==================== MAIN CONTENT ==================== */
.main-content { flex: 1; margin-left: 270px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar .topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar .avatar-sm { width: 34px; height: 34px; background: linear-gradient(135deg, var(--primary), var(--primary-hover)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.content-area { flex: 1; padding: 28px; }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 6px 8px; border-radius: var(--radius-sm); transition: var(--transition); }
.menu-toggle:hover { background: var(--surface-hover); }

/* ==================== TOPBAR ICONS ==================== */
.topbar-icon { position: relative; background: none; border: none; cursor: pointer; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-muted); display: flex; align-items: center; text-decoration: none; transition: var(--transition); }
.topbar-icon:hover { color: var(--text); background: var(--surface-hover); }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; background: var(--danger); border-radius: 50%; border: 2px solid var(--surface); }

/* ==================== USER DROPDOWN ==================== */
.user-dropdown { position: relative; }
.user-dropdown-toggle { display: flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer; padding: 6px 10px; border-radius: var(--radius); color: var(--text); transition: var(--transition); font-size: 13px; font-weight: 600; font-family: inherit; }
.user-dropdown-toggle:hover { background: var(--surface-hover); }
.user-dropdown-name { white-space: nowrap; }
.user-dropdown-menu { display: none; position: absolute; top: calc(100% + 8px); right: 0; background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 240px; box-shadow: var(--shadow-lg); z-index: 200; overflow: hidden; animation: fadeIn 0.15s ease; }
.user-dropdown-menu.show { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.dropdown-header { padding: 16px 18px 12px; }
.dropdown-header strong { display: block; font-size: 14px; color: var(--text); }
.dropdown-header span { font-size: 12px; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border); margin: 0; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 11px 18px; font-size: 13px; color: var(--text-secondary); text-decoration: none; transition: var(--transition); font-weight: 500; }
.dropdown-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.logout-item { color: var(--danger); }
.logout-item:hover { background: var(--danger-bg); color: var(--danger); }
.theme-dropdown-btn { background: none; width: 100%; text-align: left; cursor: pointer; font-family: inherit; }
.theme-dropdown-btn:hover { background: var(--surface-hover); color: var(--text); }

/* ==================== SEARCH ==================== */
.search-bar { display: flex; gap: 10px; margin-bottom: 22px; }
.search-input { padding: 10px 16px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 13px; width: 300px; background: var(--surface); color: var(--text); outline: none; transition: var(--transition); }
.search-input:focus { border-color: var(--primary); width: 350px; }

/* ==================== UPLOAD ZONE ==================== */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 35px; text-align: center; cursor: pointer; transition: var(--transition); background: var(--bg); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.preview-item { position: relative; width: 100px; height: 100px; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--border); }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .remove-file { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; background: var(--danger); color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ==================== MODALS ==================== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal-box { background: var(--surface-elevated); border-radius: var(--radius-xl); padding: 32px; max-width: 520px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal-box h3 { margin-bottom: 12px; font-size: 18px; }
.modal-box p { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ==================== UTILITIES ==================== */
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 28px; }
.p-3 { padding: 16px; }
.w-full { width: 100%; }

/* ==================== COMPACT HORIZONTAL THEME SWITCHER ==================== */
.theme-switcher {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 2px;
    gap: 1px;
    transition: var(--transition);
}
.theme-switcher:hover {
    border-color: var(--primary);
}
.theme-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}
.theme-btn:hover {
    color: var(--text);
}
.theme-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 4px var(--primary-glow);
}
.theme-btn.active:hover {
    color: #fff;
}

/* ==================== DESKTOP / MOBILE VISIBILITY ==================== */
.desktop-only { display: flex; }
.mobile-only { display: none !important; }

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    .mobile-only.theme-switcher { display: inline-flex !important; }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .sidebar { width: 250px; min-width: 250px; }
    .main-content { margin-left: 250px; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); position: fixed; width: 300px; min-width: 300px; z-index: 101; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar-close { display: flex; align-items: center; justify-content: center; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; align-items: center; justify-content: center; }
    .topbar { padding: 14px 18px; }
    .content-area { padding: 18px; }
    .form-row { grid-template-columns: 1fr; }
    .search-input { width: 100%; }
    .search-input:focus { width: 100%; }
    .user-dropdown-name { display: none; }
}

@media (max-width: 480px) {
    .sidebar { width: 100%; min-width: 100%; }
    .content-area { padding: 12px; }
    .btn { padding: 9px 16px; font-size: 13px; }
}