/* =============================
   base.css — نسخه نهایی و واکنش‌گرا
   با سایه سبز طبیعی و بهینه‌سازی موبایل
============================= */

/* ====== متغیرها ====== */
:root {
    --bg: #f7fafc;
    --card-bg: #1e1b1b;
    --text: #0f172a;
    --muted: #6b7280;
    --border: rgba(64, 78, 87, 0.56);

    --accent: #2c6e49;
    --accent-light: #d9f2e3;
    --accent-hover: #255b3f;
    --accent-foreground: #ffffff;
    --gold: #d4af37;

    --radius: 20px;
    --shadow: 0 4px 12px rgba(44, 110, 73, 0.38);
    --hover-shadow: 0 10px 26px rgba(9, 139, 66, 0.86);
    --transition: 220ms ease;
    --blur: 12px;
    --scroll: 0px;
}

/* ====== حالت دارک ====== */
[data-theme="dark"] {
    --bg: #0e141b;
    --card-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    --text: #e2e8f0;
    --muted: #a0aec0;
    --border: rgba(255, 255, 255, 0.08);

    --accent: #00bfa5;
    --accent-light: #84cba3;
    --accent-hover: #00a68f;
    --accent-foreground: rgb(34, 62, 31);

    --shadow: 0 6px 24px rgba(0, 0, 0, 0.7);
    --hover-shadow: 0 0 18px rgba(0, 191, 165, 0.35);
}

/* ====== عمومی ====== */
* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    font-family: "Vazirmatn", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
    transition: background var(--transition), color var(--transition);
}

/* ====== کانتینر ====== */
.container {
    width: min(1200px, 92%);
    margin: 0 auto;
}

/* ====== لینک‌ها ====== */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition), opacity var(--transition);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ====== کارت ====== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(44, 110, 73, 0.12);
    padding: 1rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(44, 110, 73, 0.25);
}

/* ====== تایپوگرافی ====== */
h1, h2, h3, h4 {
    margin: 0 0 .6rem;
    color: var(--accent)
}

p {
    margin: 0 0 1rem;
    color: var(--text)
}

/* ====== دکمه‌ها ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .55rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition);
    border: 1px solid transparent;
    user-select: none;
}

.like-btn {
    border: none
}

/* 🔸 پر (primary) */
.btn-primary {
    background: var(--accent);
    color: var(--accent-foreground);
    box-shadow: 0 6px 14px rgba(44, 110, 73, 0.22);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(44, 110, 73, 0.35);
}

/* 🔹 شفاف با بوردر (outline) */
.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 30px;
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--accent);
    color: var(--accent-foreground);
    box-shadow: 0 6px 14px rgba(44, 110, 73, 0.3);
}

/* 🔸 ثانویه */
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ====== ورودی‌ها ====== */
input, textarea, select {
    width: 100%;
    padding: .6rem .8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(44, 110, 73, 0.15);
}

/* ====== دکمه آیکون ====== */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid var(--border);
    transition: transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.icon-btn img, .icon-btn svg {
    width: 20px;
    height: 20px;
    filter: grayscale(1) opacity(.75);
    transition: filter var(--transition), transform var(--transition);
}

.icon-btn:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    background: rgba(44, 110, 73, 0.08);
    box-shadow: 0 4px 10px rgba(44, 110, 73, 0.25);
}

.icon-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 6px 16px rgba(44, 110, 73, 0.35);
}

.icon-btn.active img, .icon-btn.active svg {
    filter: none;
    transform: scale(1.06);
    color: var(--accent-foreground);
}

/* ====== هدر ====== */
.site-header {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), transparent);
    backdrop-filter: blur(var(--blur));
    padding: .6rem 0;
    position: sticky;
    top: 0;
    z-index: 900;
    border-bottom: 1px solid var(--border);
}

/* ====== فوتر ====== */
.main-footer {
    background: var(--card-bg);
    color: var(--text);
    border-top: 1px solid var(--border);
    padding: 2.5rem 0 1rem;
}

/* ====== Reset ====== */
ul, li {
    list-style: none;
    margin: 0;
    padding: 0
}

/* ====== Helpers ====== */
.text-muted {
    color: var(--muted)
}

.center {
    display: flex;
    align-items: center;
    justify-content: center
}

.mt-1 {
    margin-top: .5rem
}

.mb-1 {
    margin-bottom: .5rem
}

::selection {
    background-color: #00ff95;
    color: black;
}

/* =============================
   📱 Mobile Optimization Layer
============================= */
@media (max-width: 768px) {
    :root {
        --blur: 6px;
        --shadow: 0 3px 10px rgba(44, 110, 73, 0.2);
        --hover-shadow: 0 5px 14px rgba(44, 110, 73, 0.35);
    }

    body {
        font-size: .95rem;
        line-height: 1.7;
    }

    .container {
        width: 94%;
        padding-inline: .5rem;
    }

    h1 {
        font-size: 1.7rem
    }

    h2 {
        font-size: 1.4rem
    }

    h3 {
        font-size: 1.1rem
    }

    .card {
        border-radius: 14px;
        padding: .8rem;
        box-shadow: var(--shadow);
    }

    .btn {
        width: 100%;
        font-size: .95rem;
        padding: .7rem 1rem;
    }

    .site-header {
        padding: .5rem;
        text-align: center;
    }

    .main-footer {
        padding: 2rem 0 .8rem;
        text-align: center;
    }

    nav ul {
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        gap: .4rem;
        padding: 0;
    }

    nav li {
        font-size: .9rem;
    }

    input, textarea {
        font-size: .9rem;
        padding: .5rem .7rem;
    }

    .mt-1 {
        margin-top: .4rem
    }

    .mb-1 {
        margin-bottom: .4rem
    }

    p {
        font-size: .9rem
    }

    .card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }

    .btn:hover {
        transform: none
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.4rem
    }

    .btn {
        padding: .6rem;
        font-size: .85rem
    }

    .container {
        width: 96%
    }

    body {
        font-size: 0.7rem;
        line-height: 1.7;
    }

    h2 {
        font-size: 1.1rem;
    }

    h3 {
        font-size: 0.8rem;
    }

    p, a, li, input, button {
        font-size: 0.7rem;
    }

    .btn, .btn-glow {
        font-size: 0.85rem;
        padding: 0.55rem 1rem;
    }

    .section-title {
        font-size: 1.7rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }
}

/* ===========================
   🌙 Loader — طلوع نور رضوی v2
   مرکز دقیق + هماهنگی بصری
=========================== */
#page-loader {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #04130a 0%, #000000 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
    transition: opacity 0.8s ease;
    isolation: isolate;
}

#page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 🌕 نور مرکزی */
.loader-glow {
    position: absolute;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(255, 215, 100, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 3.5s infinite ease-in-out;
    filter: blur(80px);
    z-index: 0;
}

@keyframes glowPulse {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* 🔸 حلقه طلایی */
.loader-ring {
    position: absolute;
    width: 300px;
    height: 300px;
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.25);
    animation: ringRotate 6s linear infinite;
    z-index: 1;
}

@keyframes ringRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 🕌 لوگو مرکزی */
.loader-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: contain;
    z-index: 2;
    filter: drop-shadow(0 0 20px rgba(255, 230, 120, 0.9)) drop-shadow(0 0 35px rgba(212, 175, 55, 0.5));
    animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(255, 230, 120, 0.9));
    }
    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 45px rgba(255, 235, 160, 0.9));
    }
}

/* ✨ انعکاس ظریف پایین لوگو */
.loader-logo::after {
    content: "";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 40%;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.2), transparent);
    border-radius: 50%;
    filter: blur(10px);
    opacity: 0.6;
}

/* 🕊️ متن ذکر */
.loader-text {
    position: relative;
    margin-top: 2.4rem;
    color: #f9e79f;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-align: center;
    font-family: "Scheherazade New", "Vazirmatn", serif;
    text-shadow: 0 0 6px rgba(255, 215, 120, 0.6),
    0 0 20px rgba(212, 175, 55, 0.4);
    animation: textFade 2.8s ease forwards, shimmer 4s infinite linear;
    background: linear-gradient(90deg, #ffecb3, #fff, #ffd966);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    z-index: 3;
}

@keyframes textFade {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    60% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 1;
    }
}

@keyframes shimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* ✨ پارتیکل‌های طلایی */
#page-loader::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 240, 200, 0.6) 1px, transparent 1px);
    background-size: 4px 4px;
    animation: particles 15s linear infinite;
    opacity: 0.25;
    mix-blend-mode: overlay;
}

@keyframes particles {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 200px 200px;
    }
}

.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

/* ===== تصویر ===== */
.lightbox-img {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.2);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s ease;
    will-change: opacity, transform;
}

.lightbox.active .lightbox-img {
    opacity: 1;
    transform: scale(1);
}

/* 🎞 افکت fade هنگام تغییر عکس */
@keyframes fadeChange {
    0% {
        opacity: 0;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: .3s ease;
    z-index: 99999;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    touch-action: pinch-zoom;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 10px;
    transition: transform .3s ease;
}

/* دکمه‌های بالا */
.top-controls {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    gap: 15px;
    color: #fff;
    font-size: 1.6rem;
}

.top-controls span {
    cursor: pointer;
}

/* دکمه‌های کناری */
.side-controls .prev,
.side-controls .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: #fff;
    cursor: pointer;
    user-select: none;
}

.prev {
    left: 30px;
}

.next {
    right: 30px;
}

.close {
    position: absolute;
    top: 20px;
    left: 30px;
    font-size: 3rem;
    color: #fff;
    cursor: pointer;
}

.counter {
    position: absolute;
    bottom: 25px;
    font-size: 1.5rem;
    color: #fff;
}

/* lightbox base */
#global-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.65);
    transition: opacity .25s ease;
}

#global-lightbox.active {
    display: flex;
}

/* backdrop clickable area */
#global-lightbox .lb-backdrop {
    position: absolute;
    inset: 0;
}

#global-lightbox .lb-inner {
    position: relative;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* image */
#global-lightbox .lightbox-img {
    max-width: calc(100vw - 160px);
    max-height: calc(100vh - 160px);
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform .28s cubic-bezier(.2, .9, .3, 1);
    will-change: transform;
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}

/* left/right buttons (side) */
#global-lightbox .lb-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000000;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 22px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: transform .18s ease, background .18s ease;
}

#global-lightbox .prev {
    left: 18px;
}

#global-lightbox .next {
    right: 18px;
}

#global-lightbox .lb-btn:hover {
    transform: translateY(-50%) scale(1.08);
    background: rgba(0, 0, 0, 0.7);
}

#global-lightbox .lb-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000002;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    width: 46px;
    height: 46px;
    font-size: 28px;
    border-radius: 10px;
    cursor: pointer;
}

#global-lightbox .lb-download img{
    position: fixed;
    top: 20px;
    right: 80px;
    z-index: 1000002;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    width: 35px;
    height: 35px;
    font-size: 20px;
    border-radius: 10px;
    cursor: pointer;
}

#global-lightbox .lb-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000002;
    color: #fff;
    background: rgba(0,0,0,0.45);
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 15px;
    backdrop-filter: blur(6px);
}

@media (max-width: 768px) {
    #global-lightbox .lb-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    #global-lightbox .lightbox-img {
        max-width: calc(100vw - 100px);
        max-height: calc(100vh - 160px);
    }
}