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

:root {
    --primary-color: #0f172a; /* Professional Dark Navy */
    --accent-color: #10b981; /* Emerald Green */
    --secondary-color: #3b82f6; /* Azure Blue */
    --logo-bg: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --user-bg: #10b981;
    --bg-color: #f1f5f9;
    --sidebar-bg: rgba(255, 255, 255, 0.8);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --accent-red: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --base-font-size: 20px; /* Adjusted for better balance */
}

body {
    font-size: var(--base-font-size);
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    direction: rtl;
    line-height: 1.6;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    padding: 20px;
    position: relative;
    overflow-y: auto;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: var(--accent-color);
    filter: blur(150px);
    opacity: 0.1;
    top: -200px;
    right: -200px;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 4rem;
    border-radius: 30px;
    box-shadow: var(--shadow-premium);
    width: 100%;
    max-width: 550px;
    text-align: center;
    border: 1px solid var(--glass-border);
    animation: fadeInUp 0.8s ease-out;
}

.login-logo {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.login-subtitle {
    color: var(--text-light);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

.form-group {
    margin-bottom: 2rem;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.form-group input {
    width: 100%;
    padding: 1.2rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 15px;
    font-family: inherit;
    font-size: 1.1rem;
    transition: var(--transition);
    background: white;
}

.form-group input:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    transform: translateY(-2px);
}

.btn-login {
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(135deg, var(--accent-color) 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: 900;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
    margin-top: 1rem;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.3);
    filter: brightness(1.1);
}

/* Dashboard Styles */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 100px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.header-logo-section {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo-placeholder {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.header-search-container {
    position: relative;
    width: 400px;
}

.header-search-container i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.header-search-container input {
    width: 100%;
    padding: 12px 45px 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    font-family: inherit;
    transition: var(--transition);
}

.header-search-container input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: white;
    box-shadow: var(--shadow-md);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-icon-box {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    font-size: 1.4rem;
    color: var(--text-color);
}

.header-icon-box:hover {
    background: var(--bg-color);
    transform: translateY(-2px);
}

.header-icon-box .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-red);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 6px;
    border: 2px solid white;
}

.header-user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 15px;
    border-radius: 15px;
    background: var(--bg-color);
    cursor: pointer;
    transition: var(--transition);
}

.header-user-profile:hover {
    background: var(--border-color);
}

.user-info {
    text-align: left;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-color);
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-light);
}

.user-avatar {
    font-size: 2.5rem;
    color: var(--accent-color);
}

.content-wrapper {
    margin-top: 100px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-layout {
    display: flex;
    width: 100%;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 320px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--border-color);
    padding: 30px 20px;
    height: 100%;
    overflow-y: auto;
}

.menu-category {
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--text-light);
    margin: 25px 15px 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 700;
    border-radius: 12px;
    margin-bottom: 5px;
    transition: var(--transition);
}

.menu-link i {
    margin-left: 15px;
    font-size: 1.3rem;
}

.menu-link:hover {
    background: var(--bg-color);
    color: var(--accent-color);
    transform: translateX(-5px);
}

.menu-link.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
}

.menu-link.logout {
    color: var(--accent-red);
    margin-top: 50px;
}

.menu-link.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.main-content {
    flex: 1;
    padding: 50px;
    overflow-y: auto;
    height: 100%;
}

.content-header {
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.page-subtitle {
    color: var(--text-light);
    font-size: 1.2rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-bottom: 50px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    animation: fadeInUp 0.8s ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.stat-icon.emerald { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.stat-icon.amber { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }

.stat-content h3 {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-color);
}

.stat-content p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Section Styling */
.section-container {
    margin-bottom: 50px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 800;
}

.view-all-btn {
    padding: 10px 20px;
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.view-all-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Course Smart Cards */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 30px;
}

.course-smart-card {
    background: white;
    border-radius: 25px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    position: relative;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    animation: fadeInUp 0.8s ease-out backwards;
}

.course-smart-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.course-card-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-color);
    padding: 6px 15px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 800;
}

.course-card-header {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 30px;
}

.course-icon {
    width: 70px;
    height: 70px;
    background: var(--bg-color);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary-color);
}

.course-name {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.course-teacher {
    color: var(--text-light);
    font-size: 1rem;
}

.course-progress-container {
    margin-bottom: 30px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.progress-bar {
    height: 10px;
    background: var(--bg-color);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--secondary-color));
    border-radius: 5px;
}

.course-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-primary-small {
    padding: 12px 25px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary-small:hover {
    background: var(--accent-color);
    transform: scale(1.05);
}

.btn-icon-only {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--bg-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
}

.btn-icon-only:hover {
    background: var(--secondary-color);
    color: white;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* Darker grey for better visibility */
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    font-size: 1.8rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    color: var(--accent-color);
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1500;
}

/* Responsive Media Queries */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .header-search-container {
        width: 300px;
    }
}

@media (max-width: 768px) {
    :root {
        --base-font-size: 16px;
    }

    .header {
        height: 80px;
        padding: 0 20px;
    }

    .header-logo-section {
        gap: 20px;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .header-search-container {
        display: none; /* Hide search on mobile header to save space */
    }

    .header-actions {
        gap: 10px;
    }

    .header-icon-box {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .header-user-profile {
        padding: 5px 10px;
    }

    .user-info {
        display: none; /* Hide name/role on mobile */
    }

    .user-avatar {
        font-size: 2rem;
    }

    .content-wrapper {
        margin-top: 80px;
    }

    .sidebar {
        position: fixed;
        right: -100%; /* Hidden by default on the right (RTL) */
        top: 0;
        bottom: 0;
        z-index: 2000;
        transition: var(--transition);
        width: 280px;
        height: 100vh;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
        background: white;
    }

    .sidebar.active {
        right: 0;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 25px 20px;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .courses-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .course-smart-card {
        padding: 20px;
    }

    .course-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .course-name {
        font-size: 1.2rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
        border-radius: 20px;
    }

    .login-logo {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .header-actions .blue-share {
        display: none; /* Hide share button on very small screens */
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .view-all-btn {
        width: 100%;
        text-align: center;
    }
}
