/* ==========================================================
   گالری ۳۶۰ درجه — تصویر برتر
   Design tokens:
   --bg-primary   : #0B0B12  (تیره عمیق، نه مشکی خام)
   --bg-secondary : #14141F
   --accent-yellow: #FFD500  (برند)
   --accent-magenta: #E6007E (برند)
   --text-main    : #F4F3F7
   --text-muted   : #9C9AB0
   Typeface: Vazirmatn (فارسی) + Vazirmatn برای اعداد هم استفاده می‌شود
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0B0B12;
    --bg-secondary: #14141F;
    --bg-card: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(255, 255, 255, 0.08);
    --accent-yellow: #FFD500;
    --accent-magenta: #E6007E;
    --gradient-brand: linear-gradient(135deg, var(--accent-yellow), var(--accent-magenta));
    --text-main: #F4F3F7;
    --text-muted: #9C9AB0;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-glow: 0 8px 32px rgba(230, 0, 126, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--bg-primary);
    color: var(--text-main);
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    background-image:
        radial-gradient(circle at 15% 0%, rgba(230,0,126,0.12), transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(255,213,0,0.08), transparent 35%);
    background-attachment: fixed;
    padding-bottom: 90px; /* جا برای دکمه شناور */
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- هدر تبلیغاتی ---------- */
.ad-header {
    width: 100%;
    max-height: 160px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}
.ad-header img { width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 768px) {
    .ad-header { max-height: 220px; }
}

/* ---------- نوار عنوان گالری ---------- */
.gallery-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 8px;
}
.gallery-topbar h1 {
    font-size: 1.3rem;
    font-weight: 800;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- دکمه ورود مدیر (کوچک، قابل مشاهده) ---------- */
.admin-entry-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 30px;
    transition: all 0.2s ease;
}
.admin-entry-btn:hover { color: var(--accent-yellow); border-color: var(--accent-yellow); }
.admin-entry-btn svg { width: 14px; height: 14px; }

/* ---------- فیلتر دسته‌بندی ---------- */
.category-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 20px 18px;
    overflow-x: auto;
}
.category-tabs button {
    flex-shrink: 0;
    padding: 8px 18px;
    border-radius: 30px;
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.category-tabs button.active {
    background: var(--gradient-brand);
    color: #12100a;
    font-weight: 700;
    border-color: transparent;
}

/* ---------- گرید کارت‌ها ---------- */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 20px 30px;
}
@media (min-width: 480px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (min-width: 768px) {
    .card-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 0 24px 40px; }
}
@media (min-width: 1100px) {
    .card-grid { grid-template-columns: repeat(4, 1fr); }
}

.card-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-glow);
    transition: transform 0.25s ease;
}
.card-item:active { transform: scale(0.97); }

.card-preview {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
    background: #1a1a26;
}
/* پیش‌نمایش مستقیم — همان فایل ۳۶۰ آپلودشده داخل کارت به‌صورت کوچک لود می‌شود
   (نیازی به آپلود تصویر جداگانه نیست). کلیک از طریق لایه شفاف روی iframe مدیریت می‌شود. */
.card-pano-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none; /* تعامل با ویوئر داخل گالری غیرفعال است، فقط پیش‌نمایش */
    z-index: 1;
    background: #1a1a26;
}
.card-preview-link {
    position: absolute;
    inset: 0;
    z-index: 5;
}
.card-preview .pano-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(11,11,18,0.65);
    backdrop-filter: blur(6px);
    color: var(--accent-yellow);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}
.card-preview .type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(230,0,126,0.85);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 20px;
    z-index: 2;
}

.card-info { padding: 10px 12px 12px; }
.card-info h3 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.like-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.like-btn.liked { color: var(--accent-magenta); }
.like-btn svg { width: 15px; height: 15px; }

/* ---------- فوتر ---------- */
.site-footer {
    text-align: center;
    padding: 24px 20px 100px;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.site-footer strong { color: var(--accent-yellow); }

/* ---------- صفحه اختصاصی کارت (تمام‌صفحه) ---------- */
.card-full-header {
    position: fixed;
    top: 0; right: 0; left: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(to bottom, rgba(11,11,18,0.85), transparent);
}
.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 30px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}
.card-full-title { font-size: 0.95rem; font-weight: 700; }

#pano-container {
    position: fixed;
    inset: 0;
    background: #000;
}

/* ---------- دکمه شناور توضیحات + پاپ‌آپ ---------- */
.info-fab {
    position: fixed;
    bottom: 90px;
    left: 16px;
    z-index: 35;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px 10px 14px;
    background: rgba(20,20,31,0.85);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 30px;
    color: var(--accent-yellow);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    cursor: pointer;
    animation: info-fab-pulse 2.5s ease-in-out 3;
}
.info-fab svg { width: 19px; height: 19px; flex-shrink: 0; }
.info-fab span { color: var(--text-main); white-space: nowrap; }
@keyframes info-fab-pulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
    50% { box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 0 6px rgba(255,213,0,0.12); }
}

.info-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.info-overlay.open { opacity: 1; pointer-events: auto; }

.info-popup {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 22px 22px 0 0;
    padding: 24px 20px 30px;
    transform: translateY(20px);
    transition: transform 0.25s ease;
}
.info-overlay.open .info-popup { transform: translateY(0); }
@media (min-width: 640px) {
    .info-overlay { align-items: center; }
    .info-popup { border-radius: 22px; margin-bottom: 40px; }
}
.info-popup-title { font-size: 1rem; font-weight: 800; margin-bottom: 10px; color: var(--accent-yellow); }
.info-popup p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.8; }
.info-popup .external-link { display: inline-block; margin-top: 12px; font-size: 0.82rem; color: var(--accent-yellow); font-weight: 600; }
.info-close {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-glass);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
}
.info-close svg { width: 16px; height: 16px; }

/* ---------- دکمه شناور: حالت اسکرول/۳۶۰ ---------- */
.mode-toggle-float {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    display: flex;
    background: rgba(20,20,31,0.85);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 40px;
    padding: 5px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.mode-toggle-float button {
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 30px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.mode-toggle-float button.active {
    background: var(--gradient-brand);
    color: #12100a;
}

/* ---------- دکمه شناور ورود مدیر (جایگزین گزینه ثابت هدر در موبایل کوچک) ---------- */
.admin-fab {
    position: fixed;
    bottom: 20px;
    right: 16px;
    z-index: 40;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    color: var(--text-muted);
}
.admin-fab svg { width: 18px; height: 18px; }

/* ---------- فرم‌های پنل مدیریت ---------- */
.admin-wrap { max-width: 680px; margin: 0 auto; padding: 24px 18px 60px; }
.admin-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=number],
.form-group input[type=file],
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.btn-brand {
    background: var(--gradient-brand);
    color: #12100a;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
}
.btn-danger {
    background: rgba(230,0,60,0.15);
    color: #ff5a7a;
    border: 1px solid rgba(230,0,60,0.3);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.82rem; margin-bottom: 14px; }
.alert-error { background: rgba(230,0,60,0.12); color: #ff5a7a; border: 1px solid rgba(230,0,60,0.25); }
.alert-success { background: rgba(0,200,120,0.1); color: #2ee6a0; border: 1px solid rgba(0,200,120,0.25); }

.admin-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 10px;
    margin-bottom: 10px;
}
.admin-list-item img { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.admin-thumb-icon {
    width: 54px; height: 54px; flex-shrink: 0; border-radius: 10px;
    background: var(--gradient-brand); color: #12100a;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.7rem;
}
.admin-list-item .grow { flex: 1; min-width: 0; }
.admin-list-item h4 { font-size: 0.82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-list-item .order-input { width: 55px; text-align: center; }
.drag-handle { cursor: grab; color: var(--text-muted); font-size: 1.1rem; }
