@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Cairo:wght@400;600;700&display=swap');

:root {
    --bg-base: #090e1a;
    --bg-surface: rgba(17, 24, 39, 0.7);
    --bg-surface-hover: rgba(31, 41, 55, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(99, 102, 241, 0.4);
    
    --primary: hsl(239, 84%, 67%);
    --primary-hover: hsl(239, 84%, 62%);
    --secondary: hsl(263, 70%, 50%);
    --accent: hsl(190, 90%, 50%);
    --success: hsl(142, 70%, 45%);
    --danger: hsl(350, 70%, 50%);
    --warning: hsl(45, 85%, 50%);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-inverse: #0b0f19;
    
    --font-sans: 'Outfit', 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 16px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

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

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 0% 0%, hsla(243, 75%, 20%, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(263, 75%, 20%, 0.15) 0px, transparent 50%),
        radial-gradient(at 50% 0%, hsla(190, 75%, 20%, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    line-height: 1.6;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #ffffff;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: var(--font-sans);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    box-shadow: 0 4px 20px -2px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px -2px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}
.btn-danger:hover {
    filter: brightness(1.1);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 10px;
}

/* Inputs & Form Fields */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--border-color-focus);
    background: rgba(255, 255, 255, 0.05);
}

/* Layout Structures */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    background: rgba(10, 15, 30, 0.8);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar .brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 30%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.1);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.05));
    border-left: 3px solid var(--primary);
}

.main-content {
    padding: 2rem 3rem;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-card .value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #ffffff;
}

.stat-card .label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Table styling */
.table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

/* Support RTL layout for Arabic headers if user browser matches */
body[dir="rtl"] table {
    text-align: right;
}

th {
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    vertical-align: middle;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Login/Register Screens */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #a7f3d0;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none; /* Add menu button toggle in future if needed */
    }
    .main-content {
        padding: 1.5rem;
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
}
