/* ============================================
   AboutPage.css - دکمه ثابت درباره صفحه با کادر متنی
   نسخه نهایی - دکمه بالاتر و مابین هدر در موبایل
   ============================================ */

/* ===== متغیرهای پیش‌فرض (در صورت نبود مقدار از DB) ===== */
.about-page-btn,
.about-page-box {
    --about-color: #d4a847;
    --about-rgb: 212, 168, 71;
}

/* ============================================
   دکمه ثابت - سمت چپ، بالاتر از وسط
   ============================================ */
.about-page-btn {
    position: fixed;
    top: 22%;                                  /* ← بالاتر از قبل (قبلاً 30%) */
    left: 0;
    transform: translateY(-50%);
    z-index: 1000;
    padding: 1rem 0.7rem;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(
        135deg,
        var(--about-color),
        color-mix(in srgb, var(--about-color) 70%, #000)
    );
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-left: none;
    border-radius: 0 20px 20px 0;
    cursor: pointer;
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.2),
        0 0 0 0 rgba(var(--about-rgb), 0);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: 0.5px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    isolation: isolate;
}

/* ===== هاله درخشان پشت دکمه ===== */
.about-page-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at left center,
        rgba(var(--about-rgb), 0.6) 0%,
        transparent 70%
    );
    opacity: 0;
    z-index: -1;
    transition: opacity 0.35s ease;
    filter: blur(12px);
    transform: translateX(-8px);
    border-radius: inherit;
}

/* ===== آیکون دکمه ===== */
.about-page-btn .about-btn-icon {
    font-size: 1.1rem;
    line-height: 1;
    display: inline-block;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== متن دکمه ===== */
.about-page-btn .about-btn-text {
    display: inline-block;
}

/* ===== هاور ===== */
.about-page-btn:hover {
    transform: translateY(-50%) translateX(4px);
    padding-right: 1rem;
    box-shadow:
        0 8px 30px rgba(var(--about-rgb), 0.5),
        0 0 40px rgba(var(--about-rgb), 0.3);
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--about-color) 15%, #fff),
        var(--about-color)
    );
}

.about-page-btn:hover::before {
    opacity: 1;
}

.about-page-btn:hover .about-btn-icon {
    transform: scale(1.2) rotate(-8deg);
}

/* ===== کلیک ===== */
.about-page-btn:active {
    transform: translateY(-50%) translateX(2px) scale(0.97);
}

/* ===== فوکوس (دسترسی‌پذیری) ===== */
.about-page-btn:focus-visible {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

/* ============================================
   کادر متنی - باز شدن از سمت چپ (هم‌تراز با دکمه)
   ============================================ */
.about-page-box {
    position: fixed;
    top: 22%;                                  /* ← هم‌تراز با دکمه */
    left: 4rem;
    transform: translateY(-50%) translateX(-20px) scale(0.95);
    z-index: 1001;
    width: 90%;
    max-width: 420px;
    max-height: 70vh;
    overflow-y: auto;
    background: rgba(26, 42, 58, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    border: 2px solid var(--about-color);
    border-radius: 16px;
    box-shadow:
        0 12px 50px rgba(0, 0, 0, 0.45),
        0 0 60px rgba(var(--about-rgb), 0.15);
    padding: 1.5rem 1.5rem 1.2rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
}

.about-page-box.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0) scale(1);
}

/* ============================================
   هدر کادر
   ============================================ */
.about-page-box .about-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(var(--about-rgb), 0.35);
}

.about-page-box .about-box-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--about-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.4;
}

.about-page-box .about-title-icon {
    font-size: 1.2rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.about-page-box .about-title-text {
    display: inline-block;
}

/* ===== دکمه بستن ===== */
.about-page-box .about-box-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #ffffff;
    font-size: 1.4rem;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
}

.about-page-box .about-box-close:hover {
    background: rgba(228, 64, 95, 0.3);
    transform: rotate(90deg);
}

.about-page-box .about-box-close:focus-visible {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* ============================================
   متن کادر
   ============================================ */
.about-page-box .about-box-body {
    font-size: 0.95rem;
    line-height: 1.9;
    color: #e8edf3;
    text-align: right;
}

/* انیمیشن ورود تدریجی پاراگراف‌ها */
.about-page-box.show .about-box-body > * {
    animation: aboutFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}
.about-page-box.show .about-box-body > *:nth-child(1) { animation-delay: 0.10s; }
.about-page-box.show .about-box-body > *:nth-child(2) { animation-delay: 0.18s; }
.about-page-box.show .about-box-body > *:nth-child(3) { animation-delay: 0.26s; }
.about-page-box.show .about-box-body > *:nth-child(4) { animation-delay: 0.34s; }
.about-page-box.show .about-box-body > *:nth-child(5) { animation-delay: 0.42s; }
.about-page-box.show .about-box-body > *:nth-child(6) { animation-delay: 0.50s; }

@keyframes aboutFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.about-page-box .about-box-body p {
    margin: 0 0 0.75rem;
}

.about-page-box .about-box-body p:last-child {
    margin-bottom: 0;
}

.about-page-box .about-box-body strong {
    color: var(--about-color);
    font-weight: 700;
}

/* ============================================
   اسکرول‌بار کادر
   ============================================ */
.about-page-box::-webkit-scrollbar {
    width: 6px;
}

.about-page-box::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.about-page-box::-webkit-scrollbar-thumb {
    background: var(--about-color);
    border-radius: 3px;
}

.about-page-box::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--about-color) 80%, #fff);
}

/* ============================================
   واکنش‌گرایی
   ============================================ */

/* ===== موبایل ===== */
@media(max-width: 767px) {
    .about-page-btn {
        /* 
         * در موبایل: 
         * - TopIcons ≈ 50px
         * - هدر ≈ 200px
         * - مرکز هدر ≈ 50 + 100 = 150px از بالای ویوپورت
         * - از top استفاده می‌کنیم (نه درصد) تا دقیقاً وسط هدر قرار بگیرد
         * - translateY(-50%) دکمه را حول مرکز خودش تنظیم می‌کند
         */
        top: 150px;
        padding: 0.8rem 0.55rem;
        font-size: 0.8rem;
        border-radius: 0 16px 16px 0;
        gap: 0.3rem;
    }

    .about-page-btn .about-btn-icon {
        font-size: 0.95rem;
    }

    .about-page-box {
        top: 150px;                            /* ← هم‌تراز با دکمه */
        left: 3.2rem;
        width: calc(100% - 3.8rem);
        max-width: none;
        max-height: 65vh;
        padding: 1.2rem 1.1rem 1rem;
    }

    .about-page-box .about-box-title {
        font-size: 1rem;
    }

    .about-page-box .about-title-icon {
        font-size: 1.05rem;
    }

    .about-page-box .about-box-body {
        font-size: 0.85rem;
        line-height: 1.8;
    }
}

/* ===== تبلت ===== */
@media(min-width: 768px) and (max-width: 1023px) {
    .about-page-btn {
        top: 20%;                              /* ← بالاتر از قبل (قبلاً 28%) */
        padding: 0.9rem 0.6rem;
        font-size: 0.88rem;
    }

    .about-page-box {
        top: 20%;                              /* ← هم‌تراز با دکمه */
        left: 3.8rem;
        width: 380px;
        max-height: 68vh;
    }
}

/* ===== دسکتاپ ===== */
@media(min-width: 1024px) {
    .about-page-btn {
        top: 22%;                              /* ← بالاتر از قبل (قبلاً 30%) */
    }

    .about-page-box {
        top: 22%;                              /* ← هم‌تراز با دکمه */
        left: 4.2rem;
        max-width: 460px;
    }
}

/* ===== دسکتاپ بزرگ ===== */
@media(min-width: 1200px) {
    .about-page-btn {
        top: 20%;                              /* ← کمی بالاتر در صفحات بزرگ */
    }

    .about-page-box {
        top: 20%;
    }
}

/* ===== کاهش انیمیشن ===== */
@media (prefers-reduced-motion: reduce) {
    .about-page-btn,
    .about-page-box,
    .about-page-btn .about-btn-icon,
    .about-page-box.show .about-box-body > * {
        transition: none;
        animation: none;
    }
}