@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    --emerald-1: #052b21;
    --emerald-2: #06402f;
    --emerald-3: #077255;
    --gold: #b8860b;
    --gold-light: #e6c463;
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Vazirmatn', sans-serif;
    min-height: 100vh;
    color: var(--white);
    background: linear-gradient(135deg, var(--emerald-1), var(--emerald-2) 55%, var(--emerald-3));
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* حباب‌های محو شناور پس‌زمینه */
.bubble {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(230,196,99,0.25), rgba(230,196,99,0.03));
    filter: blur(2px);
    animation: floatUp 18s linear infinite;
    z-index: 0;
}
@keyframes floatUp {
    0%   { transform: translateY(0) translateX(0); opacity: 0; }
    10%  { opacity: 1; }
    100% { transform: translateY(-120vh) translateX(30px); opacity: 0; }
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

/* ---------- صفحه ورود ---------- */
.login-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 36px 28px;
    text-align: center;
}
.login-card h1 {
    font-size: 1.4rem;
    margin-bottom: 4px;
    color: var(--gold-light);
}
.login-card p.sub { color: rgba(255,255,255,0.7); margin-bottom: 24px; font-size: 0.9rem; }

.aperture {
    width: 70px; height: 70px;
    margin: 0 auto 18px;
    border-radius: 50%;
    border: 3px solid var(--gold-light);
    position: relative;
    animation: apertureSpin 1.4s ease-in-out infinite;
}
@keyframes apertureSpin {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(0.82) rotate(180deg); opacity: 0.7; }
}

.field { margin-bottom: 16px; text-align: right; }
.field label { display: block; font-size: 0.85rem; margin-bottom: 6px; color: var(--gold-light); }
.field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.06);
    color: var(--white);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color .2s;
}
.field input:focus { border-color: var(--gold-light); }

.btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    color: #241a00;
    font-weight: 700;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    text-decoration: none;
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(230,196,99,0.35); }
.btn-gold:disabled { opacity: 0.6; cursor: not-allowed; }

.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(36,26,0,0.3);
    border-top-color: #241a00;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-gold.loading .spinner { display: inline-block; }
.btn-gold.loading .btn-text { opacity: 0.8; }

.error-msg {
    background: rgba(220,53,69,0.18);
    border: 1px solid rgba(220,53,69,0.4);
    color: #ffd7dc;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.forgot-link {
    display: inline-block;
    margin-top: 16px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    text-decoration: underline;
}

.main-site-link {
    display: inline-block;
    margin-top: 22px;
    font-size: 0.82rem;
    color: var(--gold-light);
    text-decoration: none;
    border: 1px solid var(--gold-light);
    padding: 8px 18px;
    border-radius: 30px;
    transition: background .2s, color .2s;
}
.main-site-link:hover { background: var(--gold-light); color: #241a00; }

/* ---------- مودال ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 50;
    padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
    max-width: 380px;
    width: 100%;
    padding: 26px 22px;
    text-align: center;
}
.modal-box h3 { color: var(--gold-light); margin-top: 0; }
.modal-box p { font-size: 0.9rem; line-height: 1.9; color: rgba(255,255,255,0.9); }
.modal-close-x {
    position: absolute; top: 10px; left: 14px;
    cursor: pointer; font-size: 1.4rem; color: rgba(255,255,255,0.6);
}
.modal-box { position: relative; }

/* ---------- کارت پیام صوتی ---------- */
.voice-card {
    position: relative; z-index: 1;
    margin: 0 auto 20px;
    padding: 20px 22px;
    max-width: 420px;
    text-align: center;
}
.voice-card h3 { margin: 0 0 12px; color: var(--gold-light); font-size: 1rem; }
.voice-card audio { width: 100%; }

/* ---------- کارت و مودال کد تخفیف ---------- */
.discount-card {
    position: relative; z-index: 1;
    margin: 0 auto 20px;
    padding: 22px 24px;
    max-width: 420px;
    text-align: center;
    border: 1px solid rgba(184,134,11,0.45);
}
.discount-card h3 { margin: 0 0 10px; color: var(--gold-light); font-size: 1rem; }
.discount-hint { font-size: 0.82rem; color: rgba(255,255,255,0.75); line-height: 1.8; margin: 0 0 14px; }

.discount-code-box {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: rgba(184,134,11,0.14);
    border: 1px dashed rgba(184,134,11,0.55);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
}
.discount-code-box span {
    font-size: 1.1rem; font-weight: 700; letter-spacing: 1px;
    color: var(--gold-light); direction: ltr; unicode-bidi: embed;
}
.discount-expiry { font-size: 0.78rem; color: rgba(255,255,255,0.6); }
.discount-expiry.expired { color: #ffb3b3; }
.discount-card.expired { border-color: rgba(255,107,107,0.4); }
.discount-card.expired .discount-code-box { opacity: 0.55; }
.discount-card.used { border-color: rgba(255,255,255,0.15); opacity: 0.7; }
.discount-card.used .discount-code-box { justify-content: center; }
.discount-card.used .discount-code-box span { text-decoration: line-through; color: rgba(255,255,255,0.5); }

.discount-modal-box .discount-code-box { margin-top: 6px; }

/* ---------- گالری ---------- */
.top-bar {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px;
    flex-wrap: wrap;
    gap: 10px;
}
.top-bar .brand { font-weight: 700; color: var(--gold-light); font-size: 1.1rem; }
.file-number-badge { font-weight: 400; font-size: 0.78rem; color: rgba(255,255,255,0.65); margin-top: 4px; }
.top-bar .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.top-bar a.btn-outline, .top-bar button.btn-outline {
    font-family: inherit;
    font-size: 0.82rem;
    color: var(--white);
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 30px;
    text-decoration: none;
    cursor: pointer;
}
.top-bar a.btn-outline:hover, .top-bar button.btn-outline:hover { background: rgba(255,255,255,0.16); }

.message-banner {
    position: relative; z-index: 1;
    margin: 0 24px 10px;
    padding: 14px 18px;
    font-size: 0.88rem;
    color: var(--gold-light);
}

.expiry-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.78rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--glass-border);
    margin: 0 24px 16px;
    width: fit-content;
    position: relative; z-index: 1;
}
.expiry-badge.warn { animation: pulseWarn 1.4s ease-in-out infinite; border-color: #ff6b6b; color: #ffb3b3; }
@keyframes pulseWarn {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,107,0.5); }
    50% { box-shadow: 0 0 0 8px rgba(255,107,107,0); }
}

/* کارت پرداخت و ارسال رسید */
.payment-card {
    position: relative; z-index: 1;
    margin: 0 auto 20px;
    padding: 22px 24px;
    max-width: 420px;
}
.payment-card h3 { margin: 0 0 12px; color: var(--gold-light); font-size: 1rem; text-align: center; }
.payment-amount { font-size: 0.95rem; color: #fff; margin-bottom: 14px; text-align: center; }
.payment-amount b { color: var(--gold-light); font-size: 1.15rem; }

.payment-card-info {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.payment-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 7px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
}
.payment-row:last-child { border-bottom: none; }
.payment-label { font-size: 0.78rem; color: rgba(255,255,255,0.55); min-width: 70px; }
.payment-value { font-size: 0.95rem; color: #fff; font-weight: 700; letter-spacing: 0.5px; direction: ltr; unicode-bidi: embed; }
.btn-copy {
    margin-inline-start: auto;
    font-family: inherit;
    font-size: 0.72rem;
    color: var(--gold-light);
    background: rgba(184,134,11,0.15);
    border: 1px solid rgba(184,134,11,0.4);
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
}
.btn-copy:hover { background: rgba(184,134,11,0.28); }

.payment-note { font-size: 0.82rem; color: rgba(255,255,255,0.7); margin: 0 0 16px; line-height: 1.8; text-align: center; }

.payment-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-receipt {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 11px 16px;
    border-radius: 30px;
    text-decoration: none;
    color: #fff;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background .2s ease, transform .2s ease;
}
.btn-receipt svg { width: 19px; height: 19px; flex-shrink: 0; }
.btn-receipt:hover { background: rgba(255,255,255,0.14); transform: translateY(-1px); }
.btn-receipt.whatsapp svg { color: #25D366; }
.btn-receipt.telegram svg { color: #2AABEE; }
.btn-receipt.sms svg { color: var(--gold-light); }

.gallery-grid {
    position: relative; z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding: 10px 24px 60px;
}

.photo-card {
    overflow: hidden;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .6s ease, transform .6s ease;
}
.photo-card.in-view { opacity: 1; transform: translateY(0); }

.photo-thumb-wrap {
    position: relative;
    aspect-ratio: 4/3;
    background: rgba(255,255,255,0.05);
    overflow: hidden;
}
.photo-thumb-wrap img {
    width: 100%; height: 100%; object-fit: cover;
    display: block;
    -webkit-user-select: none; user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none; /* همه‌ی کلیک‌ها رو shield روی خودش می‌گیره، نه خود عکس */
    transition: transform .3s;
}
.photo-thumb-wrap:hover img { transform: scale(1.04); }

/* لایه‌ی نامرئی محافظ روی عکس؛ جلوی راست‌کلیک، ذخیره و درگ مستقیم روی <img> رو می‌گیره */
.thumb-shield {
    position: absolute; inset: 0;
    cursor: pointer;
    background: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none; user-select: none;
}

.shimmer {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.12) 37%, rgba(255,255,255,0.03) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.photo-info { padding: 12px 14px 16px; }
.photo-info .name { font-size: 0.82rem; color: rgba(255,255,255,0.85); margin-bottom: 8px; word-break: break-all; }

.progress-track {
    height: 5px;
    border-radius: 4px;
    background: rgba(255,255,255,0.12);
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 4px;
    transition: width .4s;
}
.progress-label { font-size: 0.72rem; color: rgba(255,255,255,0.6); margin-bottom: 10px; }

.btn-download {
    display: inline-flex; align-items: center; gap: 6px;
    width: 100%; justify-content: center;
    padding: 9px;
    font-size: 0.82rem;
    border-radius: 10px;
    border: none;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    color: #241a00;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
}
.btn-download.disabled { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.4); pointer-events: none; }

/* لایت‌باکس */
.lightbox {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    padding: 20px;
}
.lightbox.hidden { display: none; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 12px; -webkit-user-select:none; user-select:none; -webkit-user-drag:none; -webkit-touch-callout:none; position: relative; z-index: 1; }
.lightbox-close { position: absolute; top: 20px; left: 20px; font-size: 2rem; color: #fff; cursor: pointer; z-index: 3; }
#lightboxShield { position: absolute; inset: 0; z-index: 2; cursor: default; background: transparent; }
.lightbox.locked #lightboxShield { cursor: not-allowed; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #241a00;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
}
@keyframes toastIn { from { opacity:0; transform: translateY(10px);} to {opacity:1; transform: translateY(0);} }
@keyframes toastOut { to { opacity:0; transform: translateY(10px);} }

/* صفحه خطا */
.error-body { display:flex; align-items:center; justify-content:center; min-height:100vh; }
.error-card { padding: 34px 26px; text-align:center; max-width: 380px; }
.error-card h2 { color: #ffb3b3; }

@media (max-width: 640px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 10px 14px 50px; }
    .top-bar { padding: 14px; }
    .message-banner, .expiry-badge { margin-left: 14px; margin-right: 14px; }
    .payment-card, .voice-card, .discount-card { max-width: none; margin-left: 14px; margin-right: 14px; }
    .top-bar a.btn-outline, .top-bar button.btn-outline { flex: 1; text-align: center; }
}
