/* =============================================
   DQ Admin Panel — Base Layout & Design System
   ============================================= */

:root {
    --bg-body: #0a0a12;
    --bg-sidebar: #0f0f1a;
    --bg-header: #0d0d18;
    --bg-card: #12121e;
    --bg-card-hover: #1a1a2a;
    --bg-input: #0e0e1a;
    --border: #1e1e30;
    --border-hover: #2e2e45;
    --text: #e4e4ed;
    --text-muted: #8888a0;
    --text-dim: #55556a;
    --accent: #c9a227;
    --accent-hover: #d4ad2e;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --purple: #7c3aed;
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: 0.2s ease;
}

/* =============================================
   Reset & Base
   ============================================= */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
}

/* =============================================
   Scrollbar
   ============================================= */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* =============================================
   Layout Shell
   ============================================= */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =============================================
   Sidebar
   ============================================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    animation: sidebarSlideIn 0.4s ease forwards;
}

@keyframes sidebarSlideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo img {
    /* Keep original logo styling without background shape */
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a0a12;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* Sidebar Navigation */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px;
}

.nav-item {
    border-radius: var(--radius-sm);
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 42px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.nav-item.active .nav-link {
    background: rgba(201, 162, 39, 0.08);
    color: var(--accent);
}

.nav-item.active .nav-link::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

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

/* Submenu Chevron */

.submenu-chevron {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform 0.3s ease;
    color: var(--text-dim);
}

/* Nav Badge */

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #0a0a12;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Nav Section Labels */

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    padding: 16px 16px 8px;
    margin-top: 8px;
}

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

/* Sub-menu */

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    padding-left: 0;
}

.nav-submenu .nav-sub-item .nav-link {
    padding-left: 44px;
    font-size: 0.8rem;
    height: 34px;
    gap: 10px;
    color: var(--text-dim);
}

.nav-submenu .nav-sub-item .nav-link svg {
    width: 14px;
    height: 14px;
}

.nav-submenu .nav-sub-item .nav-link:hover {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
}

.nav-submenu .nav-sub-item.active .nav-link {
    color: var(--accent);
    background: rgba(201, 162, 39, 0.06);
}

/* Parent active when child is selected */
.nav-item.has-submenu.child-active > .nav-link {
    color: var(--text);
}

.nav-item.has-submenu.child-active > .nav-link svg:first-child {
    color: var(--accent);
}

/* Sidebar Footer */

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 12px;
}

.admin-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a0a12;
    flex-shrink: 0;
}

.admin-avatar svg {
    width: 18px;
    height: 18px;
}

.admin-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.sidebar-logout-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    transition: all var(--transition);
    flex-shrink: 0;
}

.sidebar-logout-btn svg {
    width: 15px;
    height: 15px;
}

.sidebar-logout-btn:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.admin-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-email {
    font-size: 0.7rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-credit {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-align: center;
    padding-top: 8px;
}

.sidebar-credit a {
    color: var(--accent);
    font-weight: 500;
    transition: color var(--transition);
}

.sidebar-credit a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* =============================================
   Top Header
   ============================================= */

.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(13, 13, 24, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 90;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

/* Header Page Title */

.header-page-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

/* Search Box */

.search-box {
    position: relative;
    width: 320px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-dim);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 16px 0 38px;
    font-size: 0.84rem;
    color: var(--text);
    transition: all var(--transition);
}

.search-box input::placeholder {
    color: var(--text-dim);
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.1);
}

/* Header Right */

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
    position: relative;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.header-btn svg {
    width: 18px;
    height: 18px;
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--error);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all var(--transition);
}

.notification-badge.visible {
    opacity: 1;
    transform: scale(1);
}

.header-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
}

.header-admin {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-admin-name {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text);
}

.logout-btn:hover {
    color: var(--error) !important;
}

/* =============================================
   Main Content
   ============================================= */

.main-content {
    flex: 1;
    padding: 24px;
    background: var(--bg-body);
}

.screen {
    display: none;
    animation: screenFadeIn 0.3s ease forwards;
}

.screen.active {
    display: block;
}

@keyframes screenFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   Form Elements
   ============================================= */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
}

.form-input,
.form-select,
.form-textarea {
    height: 44px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    font-size: 0.875rem;
    color: var(--text);
    transition: all var(--transition);
    width: 100%;
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-dim);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2355556a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 20px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-gold {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #0a0a12;
}

.btn-gold:hover {
    box-shadow: 0 4px 16px rgba(201, 162, 39, 0.3);
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

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

.btn-outline:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.03);
}

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

.btn-success:hover {
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
    transform: translateY(-1px);
}

.btn-sm {
    height: 34px;
    padding: 0 14px;
    font-size: 0.78rem;
}

.btn-lg {
    height: 48px;
    padding: 0 28px;
    font-size: 0.9rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* =============================================
   Toast Notifications
   ============================================= */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    font-size: 0.84rem;
    min-width: 280px;
    animation: toastIn 0.3s ease forwards;
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* =============================================
   Utility Classes
   ============================================= */

.text-gold { color: var(--accent); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.w-full { width: 100%; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* =============================================
   Overlay (for mobile sidebar)
   ============================================= */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* =============================================
   Responsive
   ============================================= */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .top-header {
        padding: 0 16px;
    }

    .search-box {
        width: 200px;
    }

    .header-admin-name {
        display: none;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 16px;
    }

    .search-box {
        width: 140px;
    }

    .search-box input {
        font-size: 0.8rem;
    }
}
