/* ===================================================================
   سیستم طراحی آپلودر Dev141 — نسخه بازطراحی‌شده
   =================================================================== */

@font-face {
    font-family: 'Vazirmatn';
    src: url('../../fonts/Vazirmatn-Bold.ttf') format('truetype');
    font-weight: 600 800;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../../fonts/Vazirmatn-Black.ttf') format('truetype');
    font-weight: 900;
    font-display: swap;
}

:root {
    --bg-0: #06070b;
    --bg-1: #0b0d14;
    --surface-1: #12151d;
    --surface-2: #191d28;
    --surface-3: #212632;
    --border: #262b38;
    --border-soft: #1c202b;
    --text-0: #f3f5fa;
    --text-1: #b7bcca;
    --text-2: #767c8d;
    --accent: #7c6cf5;
    --accent-2: #5e4de0;
    --accent-glow: rgba(124, 108, 245, 0.45);
    --pink: #ef5da8;
    --cyan: #43d9e0;
    --green: #34d399;
    --amber: #f7b955;
    --red: #f2555a;
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --radius-pill: 999px;
    --shadow-soft: 0 10px 30px rgba(0,0,0,0.35);
    --shadow-strong: 0 25px 60px rgba(0,0,0,0.55);
    --ease: cubic-bezier(.22,1,.36,1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    background: var(--bg-0);
    color: var(--text-0);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- پس‌زمینه انیمیشنی ---------- */
.bg-aurora {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: var(--bg-0);
    overflow: hidden;
}
.bg-aurora::before,
.bg-aurora::after {
    content: '';
    position: absolute;
    width: 60vw;
    height: 60vw;
    max-width: 900px;
    max-height: 900px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    animation: float-blob 22s ease-in-out infinite;
}
.bg-aurora::before {
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    top: -15%;
    right: -10%;
}
.bg-aurora::after {
    background: radial-gradient(circle, var(--pink) 0%, transparent 70%);
    bottom: -20%;
    left: -10%;
    animation-delay: -11s;
    animation-duration: 26s;
}
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(var(--border-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
    opacity: 0.5;
}

@keyframes float-blob {
    0%, 100% { transform: translate(0,0) scale(1); }
    33% { transform: translate(4%, 6%) scale(1.08); }
    66% { transform: translate(-4%, -3%) scale(0.94); }
}

/* ---------- لایه ورودی صفحه ---------- */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes scale-in {
    from { opacity: 0; transform: scale(.92); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes pop-in {
    0% { opacity: 0; transform: scale(.8) translateY(10px); }
    60% { opacity: 1; transform: scale(1.03) translateY(0); }
    100% { transform: scale(1); }
}

.page { animation: fade-up .55s var(--ease) both; }
.stagger > * { animation: fade-up .5s var(--ease) both; }
.stagger > *:nth-child(1){animation-delay:.03s} .stagger > *:nth-child(2){animation-delay:.08s}
.stagger > *:nth-child(3){animation-delay:.13s} .stagger > *:nth-child(4){animation-delay:.18s}
.stagger > *:nth-child(5){animation-delay:.23s} .stagger > *:nth-child(6){animation-delay:.28s}
.stagger > *:nth-child(n+7){animation-delay:.32s}

/* ---------- کانتینر و کارت ---------- */
.container { max-width: 880px; margin: 0 auto; padding: 28px 18px 60px; position: relative; z-index: 1; }
.container.wide { max-width: 1080px; }

.card {
    background: linear-gradient(180deg, var(--surface-1) 0%, var(--surface-1) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-soft);
    position: relative;
}
.card + .card { animation-delay: .08s; }

.glass {
    background: rgba(18, 21, 29, 0.72);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255,255,255,0.06);
}

/* ---------- تایپوگرافی ---------- */
h1, h2, h3 { font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 1.05rem; margin-bottom: 12px; color: var(--text-0); }
p { color: var(--text-1); line-height: 1.9; }
a { color: inherit; }

/* ---------- هدر مشترک ---------- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.15rem;
}
.brand-icon {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--pink));
    box-shadow: 0 8px 20px var(--accent-glow);
    color: #fff;
    animation: pulse-glow 3.5s ease-in-out infinite;
}
@keyframes pulse-glow {
    0%,100% { box-shadow: 0 8px 20px var(--accent-glow); }
    50% { box-shadow: 0 8px 32px rgba(239,93,168,0.5); }
}
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- دکمه‌ها ---------- */
.btn {
    --btn-bg: var(--surface-3);
    --btn-fg: var(--text-0);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
    isolation: isolate;
    white-space: nowrap;
}
.btn::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at var(--x,50%) var(--y,50%), rgba(255,255,255,.22), transparent 60%);
    opacity: 0;
    transition: opacity .3s;
    z-index: -1;
}
.btn:hover::after { opacity: 1; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary { --btn-bg: linear-gradient(135deg, var(--accent), var(--accent-2)); --btn-fg: #fff; box-shadow: 0 10px 24px var(--accent-glow); }
.btn-primary:hover { box-shadow: 0 14px 30px var(--accent-glow); }
.btn-danger { --btn-bg: rgba(242,85,90,0.14); --btn-fg: #ff9a9d; }
.btn-danger:hover { --btn-bg: rgba(242,85,90,0.24); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text-1); border: 1px solid var(--border); }
.btn-ghost:hover { --btn-fg: var(--text-0); border-color: var(--accent); }
.btn-success { --btn-bg: linear-gradient(135deg, #34d399, #10b981); --btn-fg: #06120c; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-icon-only { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.btn-block { width: 100%; }

/* ---------- ورودی‌ها ---------- */
.field { margin-bottom: 16px; position: relative; }
.field label { display: block; font-size: .82rem; color: var(--text-2); margin-bottom: 8px; font-weight: 600; }
input[type=text], input[type=password], input[type=search], textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--surface-3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-0);
    font-family: inherit;
    font-size: .95rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
input::placeholder, textarea::placeholder { color: var(--text-2); }
input:focus, textarea:focus {
    border-color: var(--accent);
    background: var(--surface-2);
    box-shadow: 0 0 0 4px var(--accent-glow);
}
.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-left: 46px; }
.input-icon-wrap i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-2); }
[dir=rtl] .input-icon-wrap input { padding-left: 18px; padding-right: 46px; }
[dir=rtl] .input-icon-wrap i { left: auto; right: 16px; }

/* ---------- ناحیه‌ی رها کردن فایل ---------- */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 54px 24px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: border-color .3s var(--ease), background .3s var(--ease), transform .2s;
    background: radial-gradient(circle at 50% 0%, rgba(124,108,245,.05), transparent 70%);
}
.dropzone:hover { border-color: var(--accent); background-color: rgba(124,108,245,0.05); }
.dropzone.dragover {
    border-color: var(--accent);
    background: rgba(124,108,245,0.12);
    transform: scale(1.015);
}
.dropzone.dragover .dz-icon { transform: translateY(-6px) scale(1.08); }
.dz-icon {
    width: 84px; height: 84px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 2.1rem;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--pink));
    box-shadow: 0 14px 30px var(--accent-glow);
    transition: transform .3s var(--ease);
    animation: bob 4s ease-in-out infinite;
}
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.dz-title { font-weight: 800; font-size: 1.05rem; margin-bottom: 6px; }
.dz-sub { color: var(--text-2); font-size: .85rem; }

/* ---------- صف فایل‌ها در حال آپلود ---------- */
.upload-queue { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.upload-item {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    animation: fade-up .4s var(--ease) both;
}
.upload-item-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.upload-item-icon {
    width: 40px; height: 40px; flex-shrink:0;
    border-radius: 12px;
    display: grid; place-items: center;
    background: var(--surface-3);
    color: var(--accent);
    font-size: 1.1rem;
}
.upload-item-name { font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-label { display: block; font-size: .68rem; color: var(--text-2); margin-bottom: 2px; }
.name-input {
    background: none; border: none; border-bottom: 1px dashed transparent;
    color: var(--text-0); font-weight: 700; font-size: .92rem; width: 100%;
    padding: 2px 0; font-family: inherit; outline: none;
    transition: border-color .2s;
}
.name-input:hover, .name-input:focus { border-bottom-color: var(--accent); }
.upload-item-meta { font-size: .76rem; color: var(--text-2); margin-top: 2px; }
.upload-item-actions { margin-inline-start: auto; display: flex; gap: 6px; }
.upload-item.done { border-color: rgba(52,211,153,0.35); }
.upload-item.error { border-color: rgba(242,85,90,0.4); }

/* ---------- نوار پیشرفت ---------- */
.progress-track {
    width: 100%; height: 10px;
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--accent), var(--pink));
    background-size: 200% 100%;
    transition: width .25s var(--ease);
    position: relative;
    animation: shift-gradient 2.4s linear infinite;
}
@keyframes shift-gradient { 0%{background-position:0% 0} 100%{background-position:200% 0} }
.progress-fill::after {
    content:'';
    position:absolute; inset:0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
    width: 40%;
    animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { 0%{transform:translateX(-120%)} 100%{transform:translateX(340%)} }
.progress-fill.success { background: linear-gradient(90deg, var(--green), #10b981); animation: none; }
.progress-fill.success::after { display: none; }
.progress-fill.error { background: var(--red); animation: none; }
.progress-fill.error::after { display: none; }

.progress-row { display:flex; justify-content:space-between; font-size:.78rem; color:var(--text-2); margin-top:6px; }

/* ---------- نتیجه‌ی موفق آپلود ---------- */
.link-box {
    background: var(--bg-1);
    border: 1px solid var(--border);
    padding: 8px 8px 8px 18px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    direction: ltr;
    animation: pop-in .4s var(--ease) both;
}
.link-box input { flex: 1; background: none; border: none; color: var(--cyan); font-family: monospace; font-size: .88rem; padding: 6px; }
.success-badge {
    display: inline-flex; align-items:center; gap:8px;
    color: var(--green); font-weight: 700; font-size: .9rem;
    animation: pop-in .4s var(--ease);
}
.success-check {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--green); color: #06120c;
    display: grid; place-items: center; font-size: .75rem;
}

/* ---------- مودال ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(4,5,9,0.7);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fade-in .2s ease both;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 460px; width: 100%;
    padding: 28px;
    box-shadow: var(--shadow-strong);
    animation: scale-in .28s var(--ease) both;
}
.modal-box h3 { display:flex; align-items:center; gap:10px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* ---------- توست ---------- */
#toast-stack {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(92vw, 380px);
}
.toast {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-strong);
    animation: toast-in .35s var(--ease) both;
    font-size: .88rem;
}
.toast.leaving { animation: toast-out .3s ease both; }
@keyframes toast-in { from{opacity:0; transform: translateY(16px) scale(.95)} to{opacity:1; transform:none} }
@keyframes toast-out { to{opacity:0; transform: translateY(10px) scale(.95)} }
.toast i { font-size: 1.1rem; }
.toast.success i { color: var(--green); }
.toast.error i { color: var(--red); }
.toast.info i { color: var(--cyan); }

/* ---------- آیتم فایل در تاریخچه ---------- */
.file-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 6px;
    border-bottom: 1px solid var(--border-soft);
    transition: background .2s;
    border-radius: var(--radius-sm);
}
.file-row:hover { background: rgba(255,255,255,0.02); }
.file-row:last-child { border-bottom: none; }
.file-row-icon {
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: 14px;
    display: grid; place-items: center;
    background: var(--surface-3);
    color: var(--accent);
    font-size: 1.2rem;
}
.file-row-body { flex: 1; min-width: 0; }
.file-row-name { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row-meta { font-size: .78rem; color: var(--text-2); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.file-row-meta span { display: inline-flex; align-items: center; gap: 5px; }
.file-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--surface-3);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: .74rem;
    color: var(--text-1);
}
.badge.locked { color: var(--amber); }
.badge.public { color: var(--green); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-state i { font-size: 2.6rem; margin-bottom: 14px; opacity: .5; display:block; }

/* ---------- جدول ادمین ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { padding: 14px 10px; text-align: right; border-bottom: 1px solid var(--border-soft); font-size: .9rem; }
th { color: var(--text-2); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 6px; }
.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 18px;
    position: relative;
    overflow: hidden;
}
.stat-card i { color: var(--accent); font-size: 1.3rem; margin-bottom: 10px; display:block; }
.stat-value { font-size: 1.6rem; font-weight: 800; }
.stat-label { font-size: .78rem; color: var(--text-2); margin-top: 2px; }

/* ---------- صفحه‌ی دانلود ---------- */
.download-hero { text-align: center; }
.file-icon-hero {
    width: 96px; height: 96px; margin: 0 auto 18px;
    border-radius: 26px;
    display: grid; place-items: center;
    font-size: 2.6rem;
    background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
    color: var(--accent);
    box-shadow: var(--shadow-soft);
    animation: pop-in .5s var(--ease) both;
}
.file-name-display {
    font-size: 1.3rem; font-weight: 800;
    word-break: break-word;
    background: var(--bg-1);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin: 18px 0;
    border: 1px solid var(--border-soft);
}
.file-meta-row {
    display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 22px;
}
.media-container {
    margin: 20px 0; border-radius: var(--radius-md); overflow: hidden; background: #000;
    animation: fade-in .5s ease both;
}
img.preview, video.preview { max-width: 100%; display: block; margin: 0 auto; border-radius: var(--radius-md); }
video.preview { max-height: 480px; width: auto; }
audio.preview { width: 100%; }

.error-banner {
    background: rgba(242,85,90,0.12);
    border: 1px solid rgba(242,85,90,0.3);
    color: #ff9a9d;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px;
    animation: shake .4s;
}
@keyframes shake { 10%,90%{transform:translateX(-2px)} 20%,80%{transform:translateX(3px)} 30%,50%,70%{transform:translateX(-5px)} 40%,60%{transform:translateX(5px)} }

/* ---------- ورود ---------- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; z-index: 1; }
.auth-card { max-width: 420px; width: 100%; text-align: center; }
.auth-logo {
    width: 66px; height: 66px; margin: 0 auto 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent), var(--pink));
    display: grid; place-items: center;
    font-size: 1.6rem; color: #fff;
    box-shadow: 0 14px 34px var(--accent-glow);
    animation: pulse-glow 3.5s ease-in-out infinite;
}
.auth-title { font-size: 1.3rem; margin-bottom: 4px; }
.auth-sub { color: var(--text-2); font-size: .88rem; margin-bottom: 22px; }

/* ---------- عمومی ---------- */
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.muted { color: var(--text-2); }
hr.sep { border: none; border-top: 1px solid var(--border-soft); margin: 22px 0; }

.spinner {
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: skeleton-load 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-load { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

@media (max-width: 640px) {
    .card { padding: 20px; border-radius: 22px; }
    .dropzone { padding: 38px 16px; }
    h2 { font-size: 1.15rem; }
    .file-row { flex-wrap: wrap; }
    .file-row-actions { width: 100%; justify-content: flex-start; margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
