/* ========================================
   تنظیمات پایه
======================================== */

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

@media (min-width: 1536px) {
    html {
        font-size: 15px;
    }
}

@media (min-width: 1920px) {
    html {
        font-size: 14px;
    }
}

body {
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   رفع مشکل پس‌زمینه‌های نامرتب - فقط sections
======================================== */

main section {
    position: relative;
    overflow: hidden;
}

main section > .absolute {
    position: absolute;
    overflow: hidden;
}

main section > .absolute > div {
    position: absolute;
}

/* کنترل دایره‌های gradient فقط در sections */
main section .absolute [class*="bg-gradient"] {
    max-width: 500px;
    max-height: 500px;
}

main section > .container {
    position: relative;
    z-index: 1;
}

/* ========================================
   Container
======================================== */

.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: 1400px;
    }
}

/* ========================================
   Typography
======================================== */

h1 {
    font-size: clamp(1.75rem, 3.5vw, 2.75rem);
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    line-height: 1.3;
    margin-bottom: 1.25rem;
}

h3 {
    font-size: clamp(1rem, 1.75vw, 1.25rem);
    line-height: 1.4;
}

p {
    font-size: clamp(0.875rem, 1.25vw, 1rem);
    line-height: 1.6;
}

main section > .container > .text-center > p,
main section > .container > div > p {
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   Hero Section
======================================== */

.hero-gradient {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 30%, #2a2a2a 70%, #1a1a1a 100%);
    position: relative;
    min-height: 85vh;
    padding-top: 0.5rem;
    padding-bottom: 3rem;
    overflow: hidden;
}

@media (min-width: 1536px) {
    .hero-gradient {
        min-height: 75vh;
    }
}

.hero-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(254, 160, 0, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 177, 34, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* عناوین Hero */
#home h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

#home p.text-xl {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
}

/* ========================================
   دکمه‌های Hero - بدون تغییر
======================================== */

#home a.inline-flex,
#home button.inline-flex {
    /* بدون override - از Tailwind استفاده می‌کند */
}

/* ========================================
   المان‌های شناور Hero - حفظ سایز اصلی
======================================== */

#home .floating-element,
#home .floating-element-delayed {
    /* بدون محدودیت اضافی */
}

#home .absolute .glass-effect {
    /* حفظ استایل اصلی */
}

/* ========================================
   آمار Hero
======================================== */

#home .counter {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
}

/* ========================================
   تصاویر کارت‌ها
======================================== */

.course-card > div > img,
article > div > img,
.download-card > div > img,
.portfolio-item > div > div > img {
    width: 100%;
    height: 12rem;
    object-fit: cover;
}

@media (min-width: 1536px) {
    .course-card > div > img,
    article > div > img {
        height: 11rem;
    }
}

/* آواتارها */
img.rounded-full.w-10,
img.rounded-full.h-10,
.flex img.rounded-full {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    object-fit: cover;
}

img.rounded-full.w-8,
img.rounded-full.h-8 {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    object-fit: cover;
}

#instructors img {
    width: 8rem;
    height: 8rem;
    object-fit: cover;
}

/* ========================================
   کنترل اندازه در صفحات بزرگ
======================================== */

@media (min-width: 1536px) {
    main section .grid {
        gap: 1.5rem !important;
    }
    
    .course-card .p-8,
    article .p-8,
    .portfolio-item .p-6 {
        padding: 1.5rem !important;
    }
    
    .feature-card .w-20 {
        width: 3.5rem !important;
        height: 3.5rem !important;
    }
}

/* ========================================
   دکمه‌های عادی - فقط در sections
======================================== */

main section button:not(#home button),
main section .btn:not(#home .btn),
main section a.inline-flex:not(#home a.inline-flex) {
    font-size: clamp(0.875rem, 1.2vw, 1rem);
}

/* ========================================
   انیمیشن‌ها
======================================== */

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s, transform 0.8s;
}

.fade-in.show {
    opacity: 1;
    transform: translateY(0);
}

.gradient-text {
    background: linear-gradient(135deg, #FEA000, #FFB122, #FF8C42);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.floating-element {
    animation: float 8s ease-in-out infinite;
}

.floating-element-delayed {
    animation: float 8s ease-in-out infinite;
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-15px); }
    50% { transform: translateY(-25px); }
    75% { transform: translateY(-15px); }
}

/* ========================================
   افکت‌های کارت
======================================== */

.card-hover {
    transition: transform 0.4s, box-shadow 0.4s;
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(254, 160, 0, 0.2);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glow-effect {
    box-shadow: 0 0 20px rgba(254, 160, 0, 0.3);
}

.text-shadow {
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

/* ========================================
   Portfolio Grid
======================================== */

.portfolio-masonry {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
}

@media (min-width: 768px) {
    .portfolio-masonry {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .portfolio-masonry {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1536px) {
    .portfolio-masonry {
        gap: 1.5rem;
    }
}

.portfolio-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s, transform 0.6s;
}

.portfolio-item.show {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   کارت‌های دانلود
======================================== */

.download-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.4s;
}

.download-card:hover {
    transform: translateY(-8px);
}

.download-card .download-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, rgba(254, 160, 0, 0.9), rgba(255, 177, 34, 0.9));
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-card:hover .download-overlay {
    opacity: 1;
}

/* ========================================
   کارت‌های ویژگی
======================================== */

.feature-card {
    padding: 2rem;
}

.feature-icon {
    transition: transform 0.4s;
}

.feature-card:hover .feature-icon {
    transform: scale(1.15) rotate(5deg);
}

/* ========================================
   شمارنده‌ها
======================================== */

.counter {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
}

/* ========================================
   Scroll Indicator
======================================== */

.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #FEA000, #FFB122);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ========================================
   Scrollbar
======================================== */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FEA000, #FFB122);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #FFB122, #FEA000);
}

/* ========================================
   دکمه بازگشت به بالا
======================================== */

#backToTop {
    transition: all 0.3s ease;
}

#backToTop:hover {
    box-shadow: 0 8px 25px rgba(254, 160, 0, 0.4);
}

/* ========================================
   Responsive - موبایل
======================================== */

@media (max-width: 768px) {
    /* حذف المان‌های شناور فقط در sections - نه Hero */
    main section:not(#home) .floating-element,
    main section:not(#home) .floating-element-delayed {
        display: none !important;
    }
    
    /* کاهش اندازه gradient ها فقط در sections */
    main section:not(#home) .absolute div {
        width: 50% !important;
        height: 50% !important;
        max-width: 200px !important;
        max-height: 200px !important;
        opacity: 0.4 !important;
    }
    
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    .hero-gradient {
        min-height: auto;
        padding-top: 5rem;
        padding-bottom: 3rem;
    }
    
    main section {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }
    
    .course-card > div > img,
    article > div > img {
        height: 10rem;
    }
    
    main section .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .portfolio-masonry {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .card-hover:hover {
        transform: none;
    }
}

@media (max-width: 375px) {
    .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
}