/* ============================================
   CS Dept — Imam Jafar Al-Sadiq University
   Design System V1 — Academic Dark + Gold
   ============================================ */

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/Cairo-Variable.woff2') format('woff2-variations');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Variable.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-0:        #0B1220;
    --bg-1:        #141C2E;
    --bg-2:        #1C2740;
    --surface:     #16203250;
    --border:      #26334F;
    --border-hi:   #C9A22740;

    --text-hi:     #F5F7FA;
    --text-md:     #B8C1D1;
    --text-lo:     #6B7A94;

    --accent:      #C9A227;
    --accent-2:    #8B6F1E;
    --accent-glow: #C9A22733;

    --primary:     #1E3A8A;
    --primary-hi:  #2563EB;
    --success:     #10B981;

    --font-ar:     'Cairo', system-ui, sans-serif;
    --font-lat:    'Inter', system-ui, sans-serif;

    --radius-sm:   8px;
    --radius:      14px;
    --radius-lg:   20px;
    --radius-xl:   28px;

    --shadow-sm:   0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow:      0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg:   0 16px 48px rgba(0, 0, 0, 0.5);
    --glow:        0 0 32px var(--accent-glow);

    --ease:        cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-ar);
    background: var(--bg-0);
    color: var(--text-hi);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 10%, #1E3A8A15 0%, transparent 40%),
        radial-gradient(circle at 80% 90%, #C9A22715 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.site-header {
    position: relative;
    padding: 40px 0 30px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #141C2E80 0%, transparent 100%);
}

.header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    border-radius: 50%;
    padding: 4px;
    background: var(--bg-1);
    border: 2px solid var(--accent);
    box-shadow: var(--glow);
    transition: transform 0.4s var(--ease);
}

.logo:hover { transform: scale(1.05) rotate(-2deg); }

.header-text h1 {
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text-hi);
    margin-bottom: 6px;
}

.header-text h1 .gold { color: var(--accent); font-weight: 700; }

.header-text h2 {
    font-size: clamp(16px, 3vw, 20px);
    font-weight: 600;
    color: var(--text-md);
    margin-bottom: 14px;
}

.badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: var(--bg-0);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.hero {
    padding: 60px 0 40px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 900;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-hi) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    line-height: 1.3;
}

.hero-subtitle {
    font-size: clamp(14px, 2vw, 17px);
    color: var(--text-md);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.8;
}

.section-header {
    text-align: center;
    margin: 40px 0 32px;
}

.section-header h2 {
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 800;
    color: var(--text-hi);
    margin-bottom: 6px;
    position: relative;
    display: inline-block;
    padding-bottom: 12px;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 2px;
}

.section-header p {
    color: var(--text-lo);
    font-size: 15px;
    margin-top: 12px;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0 60px;
    min-height: 200px;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-lo);
    padding: 60px 0;
    font-size: 16px;
}

.course-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border-radius: var(--radius-lg);
    background: linear-gradient(155deg, var(--bg-1) 0%, var(--bg-2) 100%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
    overflow: hidden;
    animation: cardIn 0.4s var(--ease) both;
    cursor: pointer;
}

.course-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hi);
    box-shadow: var(--shadow-lg), var(--glow);
}

.course-icon {
    font-size: 40px;
    margin-bottom: 16px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-0);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: inset 0 0 20px rgba(201, 162, 39, 0.08);
}

.course-body { flex: 1; }

.course-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-hi);
    margin-bottom: 12px;
    line-height: 1.4;
}

.course-teachers {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.teacher-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid;
    width: fit-content;
}

.teacher-tag.theory {
    background: rgba(30, 58, 138, 0.15);
    color: #93B4F5;
    border-color: rgba(37, 99, 235, 0.35);
}

.teacher-tag.practice {
    background: rgba(201, 162, 39, 0.12);
    color: var(--accent);
    border-color: var(--border-hi);
}

.teacher-tag.practice.diff {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.2) 0%, rgba(139, 111, 30, 0.2) 100%);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.course-stats {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-lo);
}

.stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-0);
    border-radius: 999px;
    border: 1px solid var(--border);
}

.course-arrow {
    position: absolute;
    top: 24px;
    left: 24px;
    font-size: 22px;
    color: var(--accent);
    opacity: 0;
    transform: translateX(8px);
    transition: all 0.3s var(--ease);
}

.course-card:hover .course-arrow {
    opacity: 1;
    transform: translateX(0);
}

.error-box {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-1);
    border: 1px solid #ef4444;
    border-radius: var(--radius);
    color: #fca5a5;
}

.error-box small {
    display: block;
    margin-top: 8px;
    opacity: 0.7;
    font-family: monospace;
    font-size: 12px;
}

.site-footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-lo);
    font-size: 14px;
    background: linear-gradient(180deg, transparent 0%, #141C2E40 100%);
}

.site-footer .copyright {
    color: var(--text-md);
    font-size: 14px;
    margin-bottom: 16px;
}

.dev-credit {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 18px 26px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(20, 28, 46, 0.8) 0%, rgba(28, 39, 64, 0.8) 100%);
    border: 1px solid var(--border);
    max-width: 100%;
}

.dev-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    color: var(--text-md);
    font-size: 15px;
}

.author {
    color: var(--accent);
    font-weight: 800;
    font-size: 17px;
    text-shadow: 0 0 20px var(--accent-glow);
    letter-spacing: -0.3px;
}

.contacts {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s var(--ease);
    border: 1px solid;
}

.contact-btn.phone {
    color: var(--text-hi);
    background: rgba(201, 162, 39, 0.08);
    border-color: var(--border-hi);
    font-family: 'Inter', monospace;
}

.contact-btn.phone:hover {
    background: rgba(201, 162, 39, 0.2);
    color: var(--accent);
    transform: translateY(-2px);
}

.contact-btn.telegram {
    color: #6CB4F0;
    background: rgba(41, 161, 219, 0.1);
    border-color: rgba(41, 161, 219, 0.35);
    font-family: 'Inter', monospace;
}

.contact-btn.telegram:hover {
    background: rgba(41, 161, 219, 0.25);
    color: #FFFFFF;
    border-color: #29A1DB;
    transform: translateY(-2px);
}

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

@media (max-width: 640px) {
    .site-header { padding: 30px 0 24px; }
    .logo { width: 80px; height: 80px; }
    .hero { padding: 40px 0 30px; }
    .courses-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .course-card { padding: 20px; }
    .course-icon { width: 56px; height: 56px; font-size: 34px; }
    .dev-credit { padding: 16px 18px; }
    .dev-line { font-size: 14px; }
    .author { font-size: 16px; }
}

@media (min-width: 1024px) {
    .courses-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
