/* ==================== متغیرهای رنگ — حالت روشن ==================== */
:root {
    --bg-primary: #FAFAFC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F4F4F8;
    --border: #E5E7EB;
    --border-strong: #D1D5DB;

    --accent-violet: #7C3AED;
    --accent-cyan: #0891B2;
    --accent-pink: #EC4899;

    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;

    --gradient-primary: linear-gradient(135deg, #7C3AED 0%, #0891B2 100%);
    --gradient-luxury: linear-gradient(135deg, #EC4899 0%, #7C3AED 50%, #0891B2 100%);
}

/* ==================== پایه ==================== */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

/* ==================== حباب‌های نور در پس‌زمینه ==================== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 15% 10%, rgba(124, 58, 237, 0.10) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(8, 145, 178, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 50% 40%, rgba(236, 72, 153, 0.05) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
}

main,
header,
footer {
    position: relative;
    z-index: 1;
}

/* ==================== اسکرول‌بار ==================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #7C3AED, #0891B2);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #8B5CF6, #06B6D4);
}

/* ==================== انتخاب متن ==================== */
::selection {
    background: var(--accent-violet);
    color: white;
}

/* ==================== متن گرادیانتی ==================== */
.gradient-text {
    background: var(--gradient-luxury);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.gradient-text-primary {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ==================== کارت شیشه‌ای ==================== */
.glass-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.03),
        0 10px 30px -10px rgba(15, 23, 42, 0.06);
}

.glass-card:hover {
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.03),
        0 25px 50px -12px rgba(124, 58, 237, 0.20);
}

/* ==================== انیمیشن‌ها ==================== */
@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }
}

.animate-float {
    animation: float 4s ease-in-out infinite;
}

@keyframes glow-pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.85;
        transform: scale(1.06);
    }
}

.animate-glow {
    animation: glow-pulse 5s ease-in-out infinite;
}

@keyframes gradient-shift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 6s ease infinite;
}

/* ==================== Utility ==================== */
.line-clamp-1,
.line-clamp-2,
.line-clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-1 {
    -webkit-line-clamp: 1;
}

.line-clamp-2 {
    -webkit-line-clamp: 2;
}

.line-clamp-3 {
    -webkit-line-clamp: 3;
}

/* ==================== دکمه اصلی ==================== */
.btn-primary {
    background: var(--gradient-primary);
    background-size: 200% 200%;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px -2px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover {
    background-position: 100% 50%;
    box-shadow: 0 15px 40px -10px rgba(124, 58, 237, 0.55);
    transform: translateY(-2px);
}

/* ==================== نوار پیشرفت مهارت ==================== */
.skill-bar {
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
    height: 8px;
    border: 1px solid var(--border);
}

.skill-bar-fill {
    background: var(--gradient-primary);
    height: 100%;
    border-radius: 999px;
    transition: width 1.5s ease;
}

/* ==================== کارت پروژه ==================== */
.project-card {
    transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.03),
        0 30px 80px -20px rgba(124, 58, 237, 0.30);
}

.project-card img {
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-card:hover img {
    transform: scale(1.08);
}

/* ==================== دکمه شناور ==================== */
.fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 40;
    box-shadow: 0 10px 40px -5px rgba(124, 58, 237, 0.5);
    transition: transform 0.3s ease;
}

.fab:hover {
    transform: scale(1.1);
}

/* ==================== سایدبار ==================== */
.sidebar-fixed {
    /* در دسکتاپ ثابت، در موبایل از js کنترل می‌شه */
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    color: #CBD5E1;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
    border-right: 2px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #FFFFFF;
    border-right-color: rgba(139, 92, 246, 0.5);
    transform: translateX(-4px);
}

.sidebar-link:hover .sidebar-icon {
    color: #8B5CF6;
    transform: scale(1.15);
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.05));
    color: #A78BFA;
    border-right-color: #8B5CF6;
    box-shadow: 0 4px 12px -4px rgba(139, 92, 246, 0.3);
}

.sidebar-link.active .sidebar-icon {
    color: #A78BFA;
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    color: #94A3B8;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* ==================== Backdrop ==================== */
.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 45;
    pointer-events: none;
}

.backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* قفل اسکرول بدنه وقتی سایدبار بازه */
body.sidebar-open {
    overflow: hidden;
    touch-action: none;
}

/* در دسکتاپ Backdrop مخفی */
@media (min-width: 1024px) {
    .backdrop {
        display: none !important;
    }
}

/* ==================== سایدبار موبایل ==================== */
#mobile-sidebar.open {
    transform: translateX(0) !important;
}

/* در دسکتاپ سایدبار همیشه باز */
@media (min-width: 1024px) {
    #mobile-sidebar {
        transform: translateX(0) !important;
    }
}

/* ==================== انیمیشن ورودی سایدبار ==================== */
@keyframes sidebarFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sidebar-fade-in {
    animation: sidebarFadeIn 0.6s ease-out both;
}

@media (min-width: 1024px) {
    .sidebar-fade-in {
        animation-delay: 0.2s;
    }
}

/* ==================== Typewriter Cursor ==================== */
.typewriter-cursor {
    color: #22D3EE;
    font-weight: 300;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ==================== اسکرول‌بار سایدبار ==================== */
#mobile-sidebar nav::-webkit-scrollbar {
    width: 4px;
}
#mobile-sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 2px;
}

/* ==================== حالت جمع‌شده سایدبار (دسکتاپ) ==================== */
@media (min-width: 1024px) {
    #mobile-sidebar.desktop-collapsed {
        transform: translateX(100%) !important;
    }
    body.sidebar-collapsed main,
    body.sidebar-collapsed footer {
        margin-right: 0 !important;
    }
}

/* ==================== سایدبار جمع‌شده (دسکتاپ) ==================== */
@media (min-width: 1024px) {
    #mobile-sidebar.desktop-collapsed {
        transform: translateX(100%) !important;
    }

    body.sidebar-collapsed main,
    body.sidebar-collapsed footer {
        margin-right: 0 !important;
        transition: margin-right 0.3s ease;
    }
}

/* انیمیشن smooth برای main وقتی سایدبار باز/بسته می‌شه */
@media (min-width: 1024px) {
    main, footer {
        transition: margin-right 0.3s ease;
    }
}