/* Base Variables */
:root {
    /* Light Theme */
    --bg-color: #f0fdf4; /* Very light green background */
    --surface-color: rgba(255, 255, 255, 0.85); /* Glassmorphism surface */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: rgba(22, 163, 74, 0.15);
    
    /* Primary brand color - Emerald/Green based to look academic/islamic */
    --primary: #059669;
    --primary-hover: #047857;
    --primary-light: #d1fae5;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --sidebar-width: 280px;
    --header-height: 70px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.85);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    
    --primary: #10b981;
    --primary-hover: #34d399;
    --primary-light: rgba(16, 185, 129, 0.2);
}

/* Reset & Global */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
    overflow-x: hidden;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-color);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 10px;
    font-weight: 500;
    transition: var(--transition);
    gap: 12px;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

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

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.user-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.mobile-header {
    display: none;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Page Sections */
.page-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
    flex: 1;
}

.page-section.active {
    display: block;
}

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

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    background: linear-gradient(135deg, var(--primary), #0284c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-header p {
    color: var(--text-secondary);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.bg-primary { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); }
.bg-success { background: linear-gradient(135deg, var(--success), #059669); }
.bg-warning { background: linear-gradient(135deg, var(--warning), #d97706); }
.bg-info { background: linear-gradient(135deg, var(--info), #2563eb); }

.stat-details h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-details h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 5px;
}

/* Action Panel */
.action-panel {
    padding: 25px;
}

.action-panel h3 {
    margin-bottom: 15px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Forms */
.form-container {
    padding: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 500;
    font-size: 0.95rem;
}

input, select, textarea {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-divider {
    height: 1px;
    background: var(--border-color);
    margin: 30px 0;
}

.section-title {
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: var(--primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-outline:hover {
    background: var(--surface-color);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Tables */
.table-container {
    padding: 25px;
}

.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 15px;
    width: 100%;
    max-width: 300px;
}

.search-box i {
    color: var(--text-secondary);
}

.search-box input {
    border: none;
    background: transparent;
    padding: 10px;
    width: 100%;
}

.search-box input:focus {
    box-shadow: none;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.02);
}

[data-theme="dark"] th {
    background: rgba(255,255,255,0.02);
}

td {
    vertical-align: middle;
}

.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }

.action-cell {
    display: flex;
    gap: 10px;
}

.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.btn-icon-sm.delete:hover { color: var(--danger); }

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.setting-card {
    padding: 25px;
}

.setting-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.setting-header i {
    font-size: 1.5rem;
    color: var(--primary);
}

.danger-zone .setting-header i {
    color: var(--danger);
}

.setting-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 34px;
}

[data-theme="dark"] .slider {
    background-color: #475569;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Footer */
footer {
    margin-top: auto;
    padding-top: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.copyright {
    font-weight: 500;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .mobile-header {
        display: flex;
    }
}
