/* ============================================
   Modern Admin Dashboard - Bayut Style
   ============================================ */

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #7c8ff5;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: rgba(148, 163, 184, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.16);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
    
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode */
body.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: rgba(148, 163, 184, 0.3);
}

/* Body Background Gradient */
body,
.admin-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #ffffff 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

body.light-mode,
body.light-mode.admin-body {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 30%, #ffffff 60%, #ffffff 100%);
    background-attachment: fixed;
}

/* ============================================
   Modern Sidebar
   ============================================ */

.admin-sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
}

.admin-sidebar::-webkit-scrollbar {
    width: 6px;
}

.admin-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1.5rem 1rem;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-light);
    transform: translateX(-2px);
}

.nav-link:hover::before {
    transform: scaleY(1);
}

.nav-item.active .nav-link {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: var(--primary-color);
    font-weight: 600;
}

.nav-item.active .nav-link::before {
    transform: scaleY(1);
}

.nav-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    transition: var(--transition);
}

.nav-item.active .nav-link i,
.nav-link:hover i {
    transform: scale(1.1);
}

.nav-link .badge {
    margin-right: auto;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

/* Nav Section Headers */
.nav-section-title {
    padding: 1.5rem 1rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Modern Header
   ============================================ */

.admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 200;
    box-shadow: var(--shadow-sm);
}

.admin-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-logo i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

/* Header Navigation */
.admin-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.admin-nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.theme-toggle:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.theme-icon {
    font-size: 1.1rem;
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.user-profile:hover {
    background: var(--primary-color);
    color: #fff;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    object-fit: cover;
}

.username {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-profile .dropdown {
    position: relative;
}

.user-profile .fa-chevron-down {
    transition: var(--transition);
    font-size: 0.8rem;
}

.user-profile:hover .fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1000;
}

.user-profile:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

.dropdown-menu hr {
    margin: 0.5rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Main Content Area
   ============================================ */

.admin-main {
    margin-right: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
    background: var(--bg-primary);
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.section-header h2 i {
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Modern Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.btn-success {
    background: var(--success-color);
    color: #fff;
}

.btn-warning {
    background: var(--warning-color);
    color: #fff;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ============================================
   Stats Cards
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

.stat-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* ============================================
   Mobile Menu & Interactions
   ============================================ */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Nav Link Ripple Effect */
.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
}

@keyframes rippleEffect {
    to {
        transform: scale(2);
        opacity: 0;
    }
}

/* Staggered Animation for Nav Items */
.nav-item {
    animation: slideInRight 0.3s ease-out;
    animation-delay: var(--stagger-delay, 0ms);
    animation-fill-mode: both;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* User Profile Dropdown Active State */
.user-profile.is-active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-profile.is-active .dropdown i.fa-chevron-down {
    transform: rotate(180deg);
}

/* Section Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    :root {
        --sidebar-width: 260px;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-right: 0;
    }

    .admin-logo h1 {
        font-size: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .admin-header-content {
        padding: 0 1rem;
    }

    .admin-main {
        padding: 1rem;
    }

    .theme-text {
        display: none;
    }

    .username {
        display: none;
    }
}
