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

:root {
    /* Psychology Theme: Indigo (Mind/Depth), Teal (Healing/Growth), Amber (Clarity) */
    --primary: #283593;
    --primary-light: #5C6BC0;
    --secondary: #26A69A;
    --accent: #FFB300;
    --danger: #E53935;
    --success: #43A047;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --bg-main: #F4F7F9;
    --bg-card: #FFFFFF;
    --border: #E2E8F0;
    --shadow: 0 4px 20px rgba(0,0,0,0.05);
    --shadow-hover: 0 10px 25px rgba(40,53,147,0.15);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.5s ease forwards; }

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}
.float-anim { animation: float 4s ease-in-out infinite; }

@keyframes pulse-glow {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}
.pulse-anim { animation: pulse-glow 2s infinite; border-radius: 50%; }

/* Student Login Page - Split Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    background: #ffffff;
}

.login-side-img {
    flex: 1;
    background: linear-gradient(135deg, rgba(26,35,126,0.9), rgba(57,73,171,0.8)), url('../images/hero.webp');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-side-img img {
    max-width: 80%;
    max-height: 50vh;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    margin-bottom: 30px;
}

.login-side-form {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: var(--bg-main);
}

.login-card {
    background: var(--bg-card);
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 450px;
    text-align: center;
    position: relative;
    z-index: 10;
}
.login-card h1 { color: var(--primary); margin-bottom: 8px; font-weight: 800; font-size: 1.8rem; }
.login-card p { color: var(--text-muted); margin-bottom: 35px; font-size: 1rem; }

@media (max-width: 900px) {
    .login-container { flex-direction: column; }
    .login-side-img { flex: 0.6; min-height: 40vh; }
    .login-side-form { flex: 1; border-top-left-radius: 30px; border-top-right-radius: 30px; margin-top: -30px; z-index: 20; }
}

/* Form Elements */
.form-group { margin-bottom: 25px; text-align: right; }
.form-label { display: block; margin-bottom: 10px; font-weight: 700; color: var(--text-main); }
.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background-color: #F8FAFC;
}
.form-control:focus { border-color: var(--primary-light); background-color: #fff; outline: none; box-shadow: 0 0 0 4px rgba(92,107,192,0.15); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; box-shadow: 0 4px 12px rgba(40,53,147,0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(40,53,147,0.4); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #00897B; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #C62828; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #2E7D32; }
.btn-block { width: 100%; display: flex; }

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, #1A237E 100%);
    color: white;
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}
.navbar-brand { font-size: 1.6rem; font-weight: 800; color: white; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.user-info { display: flex; align-items: center; gap: 12px; font-weight: 600; background: rgba(255,255,255,0.1); padding: 8px 16px; border-radius: 30px; }

/* Breadcrumb */
.breadcrumb {
    padding: 25px 5%;
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--text-muted);
    font-size: 1.05rem;
}
.breadcrumb-item { cursor: pointer; color: var(--primary-light); font-weight: 700; transition: var(--transition); }
.breadcrumb-item:hover { color: var(--primary); text-decoration: none; }
.breadcrumb-separator { color: #CBD5E1; font-size: 0.9rem; }

/* Main Layout */
.container { padding: 0 5% 40px; max-width: 1400px; margin: 0 auto; }

/* Grid & Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px 25px;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}
.card::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 4px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transform: scaleX(0); transform-origin: right; transition: transform 0.3s ease;
}
.card:hover::after { transform: scaleX(1); }
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-hover); }
.card-icon { font-size: 3rem; color: var(--primary-light); margin-bottom: 20px; text-align: center; }
.card-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 12px; color: var(--text-main); text-align: center; line-height: 1.4; }
.card-meta { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text-muted); margin-top: 15px; }

/* Material specific */
.material-card { cursor: default; padding: 25px; }
.material-card:hover::after { transform: scaleX(0); }
.badge { padding: 6px 12px; border-radius: 30px; font-size: 0.85rem; font-weight: 700; }
.badge-book { background: #E0E7FF; color: #3730A3; }
.badge-summary { background: #CCFBF1; color: #0F766E; }
.filter-tabs { display: flex; gap: 10px; margin-bottom: 25px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.tab { cursor: pointer; padding: 12px 20px; font-weight: 700; color: var(--text-muted); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.tab:hover { color: var(--primary-light); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Admin Sidebar Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--primary) 0%, #1A237E 100%);
    color: white;
    padding: 20px 0;
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
}
.sidebar-header { padding: 0 20px 25px; border-bottom: 1px solid rgba(255,255,255,0.15); margin-bottom: 25px; text-align: center; }
.sidebar-header h2 { font-weight: 800; font-size: 1.4rem; color: var(--accent); }
.nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 25px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 600;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.1); color: white; border-right: 4px solid var(--accent); }
.nav-link i { font-size: 1.2rem; width: 24px; text-align: center; }

.main-content { flex: 1; padding: 40px; background: var(--bg-main); overflow-y: auto; }

/* Admin Dashboard Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 25px; margin-bottom: 40px; }
.stat-card { background: white; padding: 25px; border-radius: var(--border-radius); box-shadow: var(--shadow); display: flex; align-items: center; gap: 20px; transition: var(--transition); }
.stat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.stat-icon { font-size: 2.5rem; color: var(--primary-light); background: #EEF2FF; padding: 20px; border-radius: 50%; }
.stat-info h3 { font-size: 2rem; margin: 0; color: var(--primary); font-weight: 800; }
.stat-info p { margin: 0; color: var(--text-muted); font-weight: 600; }

/* Table */
.table-responsive { overflow-x: auto; background: white; border-radius: var(--border-radius); box-shadow: var(--shadow); border: 1px solid rgba(0,0,0,0.03); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 18px 20px; text-align: right; border-bottom: 1px solid var(--border); }
th { background: #F8FAFC; font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.5px; }
tr { transition: var(--transition); }
tr:hover { background: #F1F5F9; }

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.6); display: none; justify-content: center; align-items: center; z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: white; padding: 35px; border-radius: var(--border-radius);
    width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.modal-header h2 { color: var(--primary); font-weight: 800; }
.close-modal { cursor: pointer; font-size: 1.5rem; color: var(--text-muted); transition: var(--transition); }
.close-modal:hover { color: var(--danger); transform: scale(1.1); }

/* File Upload */
.upload-area {
    border: 2px dashed var(--primary-light); border-radius: var(--border-radius); padding: 50px;
    text-align: center; cursor: pointer; transition: var(--transition); background: #F8FAFC;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: #EEF2FF; }
.upload-icon { font-size: 3.5rem; color: var(--primary-light); margin-bottom: 20px; transition: var(--transition); }
.upload-area:hover .upload-icon { transform: translateY(-5px); color: var(--primary); }

/* Toast */
.toast-container { position: fixed; bottom: 20px; left: 20px; z-index: 1100; display: flex; flex-direction: column; gap: 10px; }
.toast {
    padding: 15px 25px; border-radius: 8px; color: white; box-shadow: var(--shadow-hover);
    display: flex; align-items: center; gap: 10px; animation: fadeIn 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Utilities */
.hidden { display: none !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-center { text-align: center; }
.mb-3 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1rem; }

/* Loader */
.loader { border: 4px solid #f3f3f3; border-top: 4px solid var(--primary); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Mobile Menu */
.mobile-toggle { display: none; font-size: 1.5rem; cursor: pointer; color: white; }
.fab { display: none; position: fixed; bottom: 20px; right: 20px; width: 60px; height: 60px; border-radius: 50%; background: var(--primary); color: white; text-align: center; line-height: 60px; font-size: 24px; box-shadow: var(--shadow-hover); z-index: 100; cursor: pointer; }

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -280px; height: 100vh; z-index: 1050; }
    .sidebar.active { left: 0; right: 0; width: 280px; }
    .mobile-toggle { display: block; }
    .fab { display: block; }
    .table-responsive { border: 0; }
    table, thead, tbody, th, td, tr { display: block; }
    thead tr { position: absolute; top: -9999px; left: -9999px; }
    tr { border: 1px solid var(--border); margin-bottom: 10px; border-radius: 8px; background: white; padding: 10px; }
    td { border: none; border-bottom: 1px solid #eee; position: relative; padding-right: 50%; text-align: left; }
    td:before { position: absolute; right: 10px; width: 45%; padding-right: 10px; white-space: nowrap; font-weight: bold; content: attr(data-label); text-align: right; }
}

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i { font-size: 4rem; color: #ddd; margin-bottom: 20px; }
