@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --background: #f8fafc;
    --sidebar-bg: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.8);
    --glass-bg: rgba(255, 255, 255, 0.4);
    --text: #1e293b;
    --text-muted: #64748b;
    --border: rgba(226, 232, 240, 0.8);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: 'Inter', 'Cairo', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Decorations */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    right: -10%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    z-index: -1;
    filter: blur(60px);
}

body::after {
    content: '';
    position: fixed;
    bottom: -10%;
    left: -10%;
    width: 30%;
    height: 30%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    z-index: -1;
    filter: blur(60px);
}

/* Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
aside {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 0 0.5rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.3);
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.brand-name span {
    color: var(--primary-light);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.nav-item i {
    font-size: 1.25rem;
    transition: transform 0.3s;
}

.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.2);
}

.nav-item.active i {
    transform: scale(1.1);
}

/* Main Content */
main {
    flex-grow: 1;
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.page-title h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    color: var(--sidebar-bg);
}

.page-title p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Cards & Sections */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info .value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--sidebar-bg);
}

.stat-info .label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

.bg-p {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.bg-s {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.bg-a {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.75rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(79, 70, 229, 0.3);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 2rem;
}

.modal {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Timetable Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    margin-top: 1.5rem;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

th,
td {
    padding: 1.25rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timetable-cell {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.2s;
}

.active-cell {
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid var(--primary-light);
    border-radius: 12px;
    margin: 4px;
    padding: 10px;
}

.active-cell .teacher {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 0.9rem;
}

.active-cell .subject {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* RTL Adjustments */
[dir="rtl"] {
    font-family: 'Cairo', 'Inter', sans-serif;
}

[dir="rtl"] aside {
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

[dir="rtl"] th,
[dir="rtl"] td {
    border-right: none;
    border-left: 1px solid var(--border);
}

/* Animations */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}