/* ===== تنظیمات کلی و متغیرها ===== */
:root {
    --bg-dark: #0f172a;
    --bg-gradient: radial-gradient(circle at center, #1e293b 0%, #020617 100%);
    --gold: #d4af37;
    --gold-light: #f3e5ab;
    --gold-glow: rgba(212, 175, 55, 0.4);
    --red-martyr: #e11d48;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

@font-face {
    font-family: 'azarmehr';
    src: url('../fonts/AzarMehr-FD[DSTY,KSHD,wght].woff2') format('woff2');
    font-weight: 100 900;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
}

body {
    font-family: 'azarmehr', Tahoma, sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.6;
}

/* پس زمینه ذرات */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: var(--bg-gradient);
}

.overlay-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4af37' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: -1;
    pointer-events: none;
}

.highlight-red {
    color: var(--red-martyr);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(225, 29, 72, 0.3);
}

/* ===== مدیریت صفحات (SPA) ===== */
.page {
    display: none;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.page.active {
    display: block;
    opacity: 1;
}

/* ===== صفحه ورود (Intro) ===== */
#page-intro.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-box {
    text-align: center;
    cursor: pointer;
    padding: 3rem;
    transition: transform 0.5s ease;
    position: relative;
}

.logo-box:hover {
    transform: scale(1.02);
}

.main-logo {
    width: 180px;
    filter: drop-shadow(0 0 20px var(--gold-glow));
    margin-bottom: 2rem;
}

.main-title {
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.enter-btn {
    margin-top: 3rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 30px;
    border: 1px solid var(--gold);
    color: var(--gold);
    border-radius: 50px;
    transition: all 0.3s;
}

.logo-box:hover .enter-btn {
    background: var(--gold);
    color: #000;
    box-shadow: 0 0 20px var(--gold-glow);
}

/* ===== صفحه اصلی (Menu) ===== */
.main-menu-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.main-header {
    text-align: center;
    margin-bottom: 3rem;
}

.header-logo-small {
    width: 50px;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.menu-portals {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
}

.portal-card {
    flex: 1;
    min-width: 350px;
    max-width: 500px;
    height: 550px;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    background: #000;
}

/* تصویر پس زمینه */
.card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 0.8s ease;
    opacity: 0.8;
}

.portal-card:hover .card-bg {
    transform: scale(1.1);
    opacity: 0.6;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.1) 100%);
    z-index: 1;
}

.card-border {
    position: absolute;
    inset: 15px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    z-index: 2;
    transition: 0.5s;
}

.portal-card:hover .card-border {
    border-color: rgba(212, 175, 55, 0.8);
    inset: 10px;
}

.portal-content {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 3rem 2rem;
    text-align: center;
}

.icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: auto;
    margin-top: 40px;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(5px);
    transition: 0.4s;
}

.play-symbol {
    color: var(--gold);
    font-size: 1.5rem;
    margin-left: 4px;
}

.portal-card:hover .icon-circle {
    background: var(--gold);
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--gold-glow);
}

.portal-card:hover .play-symbol {
    color: #000;
}

.gallery-type .spacer {
    flex-grow: 1;
}

.portal-content h3 {
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,1);
    font-weight: 700;
    transform: translateY(20px);
    transition: 0.5s;
}

.separator-line {
    width: 50px;
    height: 2px;
    background: var(--gold);
    margin: 10px auto;
    transform: scaleX(0);
    transition: 0.5s;
}

.portal-content p {
    color: #e2e8f0;
    font-size: 1.1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: 0.5s 0.1s;
}

.portal-card:hover .portal-content h3 {
    transform: translateY(0);
}

.portal-card:hover .separator-line {
    transform: scaleX(1);
}

.portal-card:hover .portal-content p {
    opacity: 1;
    transform: translateY(0);
}

.fixed-bottom {
    margin-top: 3rem;
    position: relative;
}

/* ===== صفحه گالری (Martyrs) ===== */
.sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-header-logo {
    height: 50px;
    width: auto;
}

/* استایل دکمه صلوات */
.salavat-btn {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.1);
}

.salavat-btn:hover {
    background: var(--gold);
    color: #000;
    box-shadow: 0 0 15px var(--gold-glow);
}

.section-divider {
    text-align: center;
    margin: 4rem 0 2rem;
    position: relative;
}

.section-divider h3 {
    display: inline-block;
    font-size: 1.6rem;
    color: var(--gold-light);
    padding: 0 1.5rem;
    background: var(--bg-dark);
    position: relative;
    z-index: 1;
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding-top: 5px;
    padding-bottom: 5px;
}

.section-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
    z-index: 0;
}

.gallery-container {
    padding: 0 2rem 150px 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* شهدای شاخص */
.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    margin-bottom: 5rem;
}

.martyr-card {
    background: var(--glass-bg);
    border-radius: 15px;
    overflow: hidden;
    transition: 0.3s;
    border: 1px solid transparent;
}

.martyr-card.interactive {
    border: 1px solid var(--gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
    cursor: pointer;
}

.martyr-card.interactive:hover {
    transform: translateY(-5px);
}

.image-wrapper {
    position: relative;
    aspect-ratio: 1;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    padding: 1rem;
    text-align: center;
}

.card-info h4 {
    font-size: 1.1rem;
    color: #fff;
}

.hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: 0.3s;
}

.martyr-card.interactive:hover .hover-overlay {
    opacity: 1;
}

.hover-overlay span {
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 5px 15px;
    border-radius: 20px;
}

/* شهدای وزارت دفاع (Masonry) */
.ministry-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.masonry-item {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    aspect-ratio: 3/4;
    cursor: default;
}

.masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.masonry-item:hover img {
    transform: scale(1.1);
}

.masonry-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    padding: 20px 10px 10px 10px;
    text-align: center;
}

.masonry-overlay p {
    color: #fff;
    font-size: 0.95rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ===== مودال‌ها ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.video-box {
    width: 90%;
    max-width: 1000px;
    background: #000;
    border-radius: 10px;
    padding: 10px;
    transform: scale(0.5);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .video-box {
    transform: scale(1);
    opacity: 1;
}

.video-wrapper video {
    width: 100%;
    display: block;
    border-radius: 5px;
}

.modal-close-video {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
}

/* ===== مودال شهید (Slide Up) ===== */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.bottom-sheet-overlay.active {
    pointer-events: all;
    background: rgba(0, 0, 0, 0.8);
}

.sheet-close-btn {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 10px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 2001;
}

.sheet-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
}

.bottom-sheet-overlay.active .sheet-close-btn {
    opacity: 1;
    top: 12%;
}

.bottom-sheet-content {
    height: 80vh;
    width: 100%;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-top: 1px solid var(--gold);
    box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.8);
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
}

.bottom-sheet-overlay.active .bottom-sheet-content {
    transform: translateY(0);
}

.profile-layout {
    display: flex;
    height: 100%;
}

.visual-side {
    width: 40%;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-left: 1px solid var(--glass-border);
}

.info-side {
    width: 60%;
    padding: 3rem 4rem;
    display: flex;
    flex-direction: column;
}

.frame-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.view-mode {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: 0.5s;
    opacity: 0;
    pointer-events: none;
    cursor: pointer;
}

.view-mode.active {
    opacity: 1;
    pointer-events: all;
}

#modal-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.interaction-hint {
    position: absolute;
    bottom: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    pointer-events: none;
    border: 1px solid var(--gold);
    color: var(--gold);
}

/* ===== شمع حرفه‌ای ===== */
.pro-candle {
    position: relative;
    width: 80px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.pro-candle.large {
    transform: scale(1.5); /* شمع بزرگتر برای حالت تمام صفحه */
    margin-bottom: 3rem;
}

.wax-body {
    width: 60px;
    height: 140px;
    background: linear-gradient(to right, #e6e6fa, #fff, #e6e6fa);
    border-radius: 4px;
    box-shadow: inset -5px 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.wick {
    width: 4px;
    height: 15px;
    background: #222;
    margin-bottom: -5px;
    z-index: 2;
}

.flame-container {
    position: relative;
    width: 30px;
    height: 50px;
    transform-origin: center bottom;
    animation: flicker-move 2s infinite alternate;
}

.flame-main {
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, #ff6b35, #ffd700);
    border-radius: 50% 50% 20% 20%;
    box-shadow: 0 0 20px #ff6b35;
}

.flame-inner {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 50%;
    background: #fff;
    border-radius: 50%;
    opacity: 0.8;
}

.glow-halo {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255, 165, 0, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    animation: glow-pulse 2s infinite alternate;
}

.drip {
    background: #fff;
    position: absolute;
    border-radius: 10px;
}

.drip-1 {
    width: 8px;
    height: 30px;
    top: 5px;
    left: 10px;
}

.drip-2 {
    width: 6px;
    height: 20px;
    top: 10px;
    right: 15px;
}

@keyframes flicker-move {
    0% { transform: rotate(-2deg) scale(1); }
    50% { transform: rotate(2deg) scale(1.05); }
    100% { transform: rotate(-1deg) scale(0.95); }
}

@keyframes glow-pulse {
    from { opacity: 0.6; transform: translateX(-50%) scale(1); }
    to { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.spiritual-text {
    font-family: 'azarmehr', serif;
    font-size: 1.5rem;
    color: var(--gold);
    text-align: center;
    line-height: 1.8;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* ===== لایه صلوات (جدید) ===== */
#salavat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    cursor: pointer;
}

#salavat-overlay.active {
    opacity: 1;
    visibility: visible;
}

.salavat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.8);
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#salavat-overlay.active .salavat-content {
    transform: scale(1);
}

.large-text {
    font-size: 1.8rem;
    font-weight: bold;
}

/* ===== پلیر صوتی حرفه‌ای ===== */
.pro-audio-player {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 2rem;
    backdrop-filter: blur(5px);
}

.play-btn-pro {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gold);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--gold-glow);
    transition: 0.3s;
    flex-shrink: 0;
}

.play-btn-pro:hover {
    transform: scale(1.1);
    background: #fff;
}

.play-btn-pro.playing {
    background: var(--red-martyr);
    box-shadow: 0 0 20px rgba(225, 29, 72, 0.6);
}

.play-icon {
    font-size: 1.5rem;
    color: #000;
    margin-left: 3px;
}

.play-btn-pro.playing .play-icon {
    content: '';
    margin: 0;
}

.player-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.visualizer-container {
    display: flex;
    gap: 3px;
    height: 30px;
    align-items: flex-end;
    width: 100%;
    overflow: hidden;
}

.bar {
    flex: 1;
    background: var(--gold);
    border-radius: 2px;
    height: 3px;
    transition: height 0.1s ease;
    opacity: 0.5;
}

.pro-audio-player.active .bar {
    opacity: 1;
    animation: equalize 0.5s infinite alternate;
}

.bar:nth-child(odd) { animation-duration: 0.4s; }
.bar:nth-child(2n) { animation-duration: 0.3s; }
.bar:nth-child(3n) { animation-duration: 0.5s; }
.bar:nth-child(4n) { animation-duration: 0.2s; }

@keyframes equalize {
    0% { height: 10%; }
    100% { height: 100%; }
}

.martyr-title {
    font-size: 2.2rem;
    color: var(--gold);
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.bio-scroll {
    flex-grow: 1;
    overflow-y: auto;
    color: #cbd5e1;
    font-size: 1.1rem;
    line-height: 2;
    padding-left: 15px;
    margin-bottom: 0;
    text-align: justify;
    text-justify: inter-word;
}

.bio-scroll::-webkit-scrollbar {
    width: 8px;
}

.bio-scroll::-webkit-scrollbar-thumb {
    background: var(--gold-glow);
    border-radius: 4px;
}

.nav-back-btn {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    transition: 0.3s;
}

.nav-back-btn:hover {
    background: var(--gold);
    color: #000;
}

/* ریسپانسیو */
@media (max-width: 1100px) {
    .profile-layout {
        flex-direction: column;
    }

    .visual-side {
        width: 100%;
        height: 350px;
        border-left: none;
        border-bottom: 1px solid var(--glass-border);
    }

    .info-side {
        width: 100%;
        padding: 2rem;
        height: auto;
        flex-grow: 1;
    }

    .sheet-close-btn {
        top: 5%;
    }

    .bottom-sheet-overlay.active .sheet-close-btn {
        top: 7%;
    }

    .gallery-container {
        max-width: 95%;
    }
}

@media (max-width: 768px) {
    .menu-portals {
        flex-direction: column;
        align-items: center;
    }

    .portal-card {
        width: 100%;
        height: 400px;
    }
}