@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #00d4aa;
    --warning: #feca57;
    --danger: #ff6b6b;
    
    /* Light theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #1a1a1a;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: rgba(0,0,0,0.1);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
    
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #0f0f1e;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #b8c1ec;
    --text-muted: #8892b0;
    --border-color: rgba(255,255,255,0.1);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.8;
    overflow-x: hidden;
    transition: var(--transition);
    position: relative;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Animated Background - SAME AS COURSES */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    opacity: 0.25;
    transition: opacity 0.6s ease;
}

[data-theme="dark"] .animated-bg {
    opacity: 0.35;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    animation: float 15s infinite ease-in-out;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #a78bfa, #c084fc);
    top: -15%;
    right: -15%;
    animation-delay: 0s;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #60a5fa, #93c5fd);
    bottom: -10%;
    left: -10%;
    animation-delay: 3s;
}

.shape-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #fb923c, #fdba74);
    top: 30%;
    left: 60%;
    animation-delay: 6s;
}

.shape-4 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #34d399, #6ee7b7);
    top: 60%;
    right: 20%;
    animation-delay: 9s;
}

.shape-5 {
    width: 280px;
    height: 280px;
    background: linear-gradient(135deg, #fbbf24, #fcd34d);
    bottom: 40%;
    left: 15%;
    animation-delay: 12s;
}

.shape-6 {
    width: 320px;
    height: 320px;
    background: linear-gradient(135deg, #ec4899, #f472b6);
    top: 10%;
    left: 30%;
    animation-delay: 15s;
}

[data-theme="dark"] .shape-1 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    animation: floatDark 12s infinite ease-in-out;
}

[data-theme="dark"] .shape-2 {
    background: linear-gradient(135deg, #f093fb, #667eea);
    animation: floatDark 12s infinite ease-in-out;
    animation-delay: 3s;
}

[data-theme="dark"] .shape-3 {
    background: linear-gradient(135deg, #764ba2, #f093fb);
    animation: floatDark 12s infinite ease-in-out;
    animation-delay: 6s;
}

[data-theme="dark"] .shape-4 {
    background: linear-gradient(135deg, #00d4aa, #667eea);
    animation: floatDark 12s infinite ease-in-out;
    animation-delay: 9s;
}

[data-theme="dark"] .shape-5 {
    background: linear-gradient(135deg, #feca57, #f093fb);
    animation: floatDark 12s infinite ease-in-out;
    animation-delay: 12s;
}

[data-theme="dark"] .shape-6 {
    background: linear-gradient(135deg, #764ba2, #00d4aa);
    animation: floatDark 12s infinite ease-in-out;
    animation-delay: 15s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        transform: translate(50px, 40px) rotate(45deg) scale(1.05);
    }
    50% {
        transform: translate(0, 80px) rotate(90deg) scale(0.95);
    }
    75% {
        transform: translate(-40px, 40px) rotate(135deg) scale(1.02);
    }
}

@keyframes floatDark {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        transform: translate(80px, 60px) rotate(90deg) scale(1.1);
    }
    50% {
        transform: translate(0, 120px) rotate(180deg) scale(0.9);
    }
    75% {
        transform: translate(-60px, 60px) rotate(270deg) scale(1.05);
    }
}

/* Particles */
.particles {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 0.6s ease;
}

[data-theme="dark"] .particles {
    opacity: 0.7;
}

.particle {
    position: absolute;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    opacity: 0.6;
    animation: particleFloat 20s linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-150px) translateX(100px) rotate(180deg);
        opacity: 0;
    }
}

[data-theme="dark"] .particle {
    animation: particleFloatDark 15s linear infinite;
}

@keyframes particleFloatDark {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-200px) translateX(150px) rotate(360deg);
        opacity: 0;
    }
}

/* Header - SAME AS COURSES */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

[data-theme="dark"] .header {
    background: rgba(10, 14, 26, 0.95);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 20px;
    padding-bottom: 20px;
}

.logo {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    line-height: 1.3;
}

.logo a {
    text-decoration: none;
    color: inherit;
}

.nav {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
    position: relative;
    padding: 8px 0;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link:hover::before,
.nav-link.active::before {
    width: 100%;
}

.nav-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.theme-toggle {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.theme-icon {
    position: absolute;
    font-size: 20px;
    transition: var(--transition);
}

.theme-icon.sun {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.theme-icon.moon {
    opacity: 0;
    transform: scale(0) rotate(180deg);
}

[data-theme="dark"] .theme-icon.sun {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
}

[data-theme="dark"] .theme-icon.moon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.header-login {
    padding: 10px 24px;
    border: 1.5px solid rgba(102, 126, 234, 0.4);
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
}

.header-login:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    color: white;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Hero Section */
.hero-section {
    padding: clamp(60px, 10vh, 100px) 0;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(32px, 6vw, 56px);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    animation: fadeInUp 0.8s ease;
}

.hero-subtitle {
    font-size: clamp(16px, 3vw, 20px);
    color: var(--text-secondary);
    animation: fadeInUp 0.8s ease 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gallery Grid - MASONRY LAYOUT */
.gallery-section {
    padding: 0 0 clamp(60px, 10vh, 100px);
    position: relative;
    z-index: 1;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    grid-auto-flow: dense;
}

.gallery-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.6s ease both;
    position: relative;
}

.gallery-card:nth-child(1) { animation-delay: 0.1s; }
.gallery-card:nth-child(2) { animation-delay: 0.15s; }
.gallery-card:nth-child(3) { animation-delay: 0.2s; }
.gallery-card:nth-child(4) { animation-delay: 0.25s; }
.gallery-card:nth-child(5) { animation-delay: 0.3s; }
.gallery-card:nth-child(6) { animation-delay: 0.35s; }
.gallery-card:nth-child(7) { animation-delay: 0.4s; }
.gallery-card:nth-child(8) { animation-delay: 0.45s; }
.gallery-card:nth-child(9) { animation-delay: 0.5s; }

.gallery-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.gallery-image-wrapper {
    position: relative;
    height: 280px;
    overflow: hidden;
}

.gallery-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-card:hover .gallery-image-wrapper img {
    transform: scale(1.15) rotate(2deg);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    color: white;
}

.gallery-card:hover .gallery-overlay {
    opacity: 1;
}

.gallery-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: zoomIn 0.5s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.gallery-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    animation: slideUp 0.5s ease 0.1s both;
}

.gallery-desc {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    animation: slideUp 0.5s ease 0.2s both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: zoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 50px;
    height: 50px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 32px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.lightbox-close:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.lightbox-image-container {
    max-width: 900px;
    max-height: 600px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 80px -20px rgba(0,0,0,0.8);
}

.lightbox-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.lightbox-info {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.lightbox-info h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.lightbox-info p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.lightbox-info span {
    font-size: 13px;
    color: var(--text-muted);
}

/* No Gallery */
.no-gallery {
    text-align: center;
    padding: 80px 20px;
    animation: fadeInUp 0.8s ease;
}

.no-gallery-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.no-gallery h2 {
    font-size: 28px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.no-gallery p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 48px 0 24px;
    margin-top: 80px;
    position: relative;
    z-index: 1;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}

.footer-col h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-col p,
.footer-col a {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .header .container {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding-top: 16px;
        padding-bottom: 16px;
    }
    
    .menu-toggle {
        order: 3;
        margin: 0;
    }
    
    .nav-actions {
        order: 2;
        margin: 0 auto 0 12px;
        gap: 12px;
    }
    
    .logo {
        order: 1;
        margin: 0;
        font-size: 0.9rem;
        line-height: 1.2;
        text-align: right;
    }
    
    .header-login {
        display: inline-block;
        padding: 8px 16px;
        font-size: 13px;
    }

    .nav {
        position: fixed;
        top: 65px;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 0;
        z-index: 998;
        box-shadow: var(--shadow-lg);
    }

    .nav.active {
        max-height: 400px;
        opacity: 1;
        padding: 16px;
    }

    .nav-link {
        padding: 16px 20px;
        width: 100%;
        display: block;
        border-radius: 12px;
        transition: background 0.3s ease;
        text-align: right;
        font-size: 16px;
        background: transparent;
        color: var(--text-primary);
    }
    
    .nav-link:hover {
        background: rgba(102, 126, 234, 0.1);
        color: var(--text-primary);
    }

    .nav-link::before {
        display: none;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-image-wrapper {
        height: 220px;
    }
    
    .lightbox-content {
        max-width: 95vw;
    }
    
    .lightbox-image-container {
        max-height: 50vh;
    }
}

/* Reduce particles/animations on mobile */
@media (max-width: 768px) {
    .particle:nth-child(n+20) {
        display: none;
    }
    
    .shape {
        animation-duration: 20s !important;
    }
    
    [data-theme="dark"] .shape {
        animation-duration: 16s !important;
    }
}
