/* ===== فونت وزیرمتن ===== */
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ===== متغیرها ===== */
:root {
    --primary: #6366f1;
    --primary-2: #8b5cf6;
    --accent: #06b6d4;
    --grad: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #d946ef);
    --ink: #1e293b;
    --muted: #64748b;
    --bg: #f1f5f9;
    --card: #ffffff;
    --radius: 22px;
    --shadow: 0 24px 60px -24px rgba(99, 102, 241, 0.30);
    --shadow-sm: 0 10px 30px -12px rgba(2, 6, 23, 0.15);
}

* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(900px 400px at 85% -5%, rgba(139, 92, 246, 0.10), transparent 60%),
        radial-gradient(800px 380px at 10% 0%, rgba(6, 182, 212, 0.08), transparent 55%);
    background-attachment: fixed;
    color: var(--ink);
    line-height: 1.8;
}

/* اسکرول‌بار سفارشی */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: #e9edf5;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--primary-2));
    border-radius: 20px;
    border: 2px solid #e9edf5;
}

/* ===== هدر ===== */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4c1d95 75%, #701a75 100%);
    color: #fff;
    padding: 90px 0 100px;
    text-align: center;
    border-radius: 0 0 48px 48px;
    margin-bottom: -70px;
}

.hero::before,
.hero::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    animation: float 16s ease-in-out infinite;
}
.hero::before {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.9), transparent 70%);
    top: -140px;
    left: 8%;
}
.hero::after {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.9), transparent 70%);
    bottom: -120px;
    right: 6%;
    animation-delay: -8s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(28px) scale(1.08); }
}

.hero-icon {
    width: 84px;
    height: 84px;
    margin: 0 auto 22px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 26px;
    font-size: 2rem;
    color: #fff;
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
}

.hero h1 {
    position: relative;
    font-weight: 800;
    font-size: clamp(1.9rem, 4.5vw, 3rem);
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.hero .lead {
    position: relative;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto;
}

/* ورود مدیر */
.hero .btn-admin-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 26px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 18px;
    border-radius: 999px;
    transition: all 0.3s;
    backdrop-filter: blur(6px);
}
.hero .btn-admin-link:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-2px);
    color: #fff;
}

/* ===== کارت‌ها ===== */
.card {
    border: 1px solid rgba(226, 232, 240, 0.7);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.main-card {
    margin-top: 40px;
}
.main-card .card-body {
    padding: 2.4rem;
}

.card-title-band {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}
.card-title-band .icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    background: var(--grad);
    color: #fff;
    box-shadow: 0 12px 24px -8px rgba(99, 102, 241, 0.55);
    flex-shrink: 0;
}
.card-title-band h3 {
    margin: 0;
    font-weight: 700;
    font-size: 1.25rem;
}

/* ===== فرم‌ها ===== */
.form-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--ink);
}

.form-control,
.form-select {
    border-radius: 14px;
    border: 1.5px solid #e2e8f0;
    padding: 0.65rem 1rem;
    font-family: inherit;
    transition: border-color 0.25s, box-shadow 0.25s;
    background: #fff;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
}
.form-control-lg {
    padding: 0.85rem 1.15rem;
    border-radius: 16px;
}
.form-text {
    color: var(--muted);
    font-size: 0.83rem;
}

/* کپچا */
.captcha-box {
    background: linear-gradient(160deg, #f4f5ff, #faf7ff);
    border: 1.5px dashed rgba(99, 102, 241, 0.35);
    border-radius: 18px;
    padding: 1.2rem;
}
.captcha-frame {
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.captcha-frame img {
    display: block;
    width: 100%;
    height: auto;
}
.refresh-captcha {
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    transition: all 0.25s;
    text-decoration: none;
}
.refresh-captcha:hover {
    color: var(--primary-2);
    transform: rotate(-180deg) scale(1.05);
    display: inline-flex;
}

/* دکمه‌ها */
.btn {
    border-radius: 999px;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.28s ease;
}
.btn-gradient {
    background: var(--grad);
    color: #fff;
    border: none;
    background-size: 160% auto;
    box-shadow: 0 16px 34px -12px rgba(124, 58, 237, 0.55);
}
.btn-gradient:hover {
    background-position: right center;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 22px 42px -14px rgba(124, 58, 237, 0.65);
}
.btn-gradient:active {
    transform: translateY(-1px);
}
.btn-outline-primary {
    border: 1.5px solid var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

/* نتیجه لینک کوتاه */
.short-url-box {
    background: linear-gradient(160deg, #eef2ff, #f5f3ff);
    border: 1.5px dashed rgba(139, 92, 246, 0.4);
    border-radius: 18px;
    padding: 1.5rem;
}
.short-url-box h5 {
    font-weight: 700;
}

/* ===== جدول ===== */
.table {
    margin-bottom: 0;
}
.table thead th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.85rem;
    border-bottom: 2px solid #eef2f7;
    white-space: nowrap;
    padding: 0.9rem 1rem;
}
.table tbody td {
    border-color: #f1f5f9;
    vertical-align: middle;
    padding: 0.9rem 1rem;
}
.table tbody tr {
    transition: background 0.2s;
}
.table tbody tr:hover {
    background: #fafaff;
}
.badge-soft {
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 700;
    padding: 0.35em 0.8em;
    border-radius: 999px;
}
.ellipsis-cell {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== پنل ادمین ===== */
.admin-header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 45%, #312e81 100%);
    color: #fff;
    padding: 46px 0;
    border-radius: 0 0 48px 48px;
    margin-bottom: -56px;
}
.admin-header::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.7), transparent 70%);
    top: -120px;
    left: 5%;
    filter: blur(60px);
    animation: float 18s ease-in-out infinite;
}
.admin-header .container {
    position: relative;
}
.admin-header h2 {
    font-weight: 800;
}
.admin-header p {
    color: rgba(255, 255, 255, 0.75);
}

/* استات‌ها */
.stat-card {
    text-align: center;
    padding: 1.6rem 1rem;
    border-radius: var(--radius);
    transition: transform 0.3s, box-shadow 0.3s;
}
.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 26px 50px -22px rgba(99, 102, 241, 0.4);
}
.stat-card .icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 12px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    color: #fff;
}
.icon.purple { background: var(--grad); }
.icon.green  { background: linear-gradient(135deg, #10b981, #34d399); }
.icon.amber  { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-card .number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
}

/* لاگین */
.login-box {
    max-width: 440px;
    margin: 90px auto 60px;
}
.login-icon {
    width: 78px;
    height: 78px;
    margin: 0 auto 18px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    font-size: 1.8rem;
    color: #fff;
    background: var(--grad);
    box-shadow: 0 18px 36px -12px rgba(124, 58, 237, 0.55);
}

/* فاصله بالای محتوا در پنل */
.panel-content {
    margin-top: 96px;
}

/* هشدارها */
.alert {
    border-radius: 16px;
    border: none;
    box-shadow: var(--shadow-sm);
}

/* فوتر */
.footer {
    text-align: center;
    padding: 46px 0 30px;
    color: var(--muted);
    font-size: 0.9rem;
}
.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.footer a:hover {
    color: var(--primary-2);
}

/* تست */
.toast-msg {
    position: fixed;
    bottom: 28px;
    right: 50%;
    transform: translate(50%, 80px);
    background: #0f172a;
    color: #fff;
    padding: 12px 24px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 18px 40px -10px rgba(2, 6, 23, 0.5);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 1050;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast-msg.show {
    opacity: 1;
    transform: translate(50%, 0);
}

@media (max-width: 767px) {
    .hero { padding: 60px 0 70px; border-radius: 0 0 32px 32px; margin-bottom: -46px; }
    .main-card .card-body { padding: 1.4rem; }
    .admin-header { border-radius: 0 0 32px 32px; margin-bottom: -44px; }
    .panel-content { margin-top: 78px; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }
    .table tbody tr {
        border: 1px solid #f1f5f9;
        border-radius: 14px;
        margin-bottom: 12px;
        padding: 8px;
    }
    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        border: none;
        padding: 0.55rem 0.6rem;
        text-align: left;
    }
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--muted);
        font-size: 0.8rem;
    }
}