/* ====== ریست و متغیرها ====== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ====== فونت وزیرمتن (لوکال) ====== */
@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-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease;
}

/* ====== حالت شب (Dark Mode) ====== */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* انتقال نرم هنگام تغییر تم */
body, .card, .site-header, .site-footer, .form-control, .upload-area, 
.file-item, .stat-card, .feature-card, .alert, .download-link-box,
.file-info-item, .admin-table, .table-row, .badge {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ====== هدر ====== */
.site-header {
    background: var(--bg-card);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon { font-size: 1.5rem; }
.logo-text { color: var(--primary); }

.main-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.main-nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.main-nav a:hover { color: var(--primary); }

.user-greeting {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
}

a.user-greeting:hover {
    color: var(--primary);
}

/* ====== دکمه تغییر تم ====== */
.theme-toggle {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
    padding: 0;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: rotate(20deg) scale(1.1);
}

.theme-toggle .theme-icon-dark {
    display: none;
}

.theme-toggle .theme-icon-light {
    display: inline;
}

[data-theme="dark"] .theme-toggle .theme-icon-dark {
    display: inline;
}

[data-theme="dark"] .theme-toggle .theme-icon-light {
    display: none;
}

/* ====== دکمه‌ها ====== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-logout {
    color: var(--danger) !important;
}

/* ====== پیام‌ها ====== */
.alert {
    padding: 14px 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 500;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-info    { background: #dbeafe; color: #1e40af; }
.alert-warning { background: #fef3c7; color: #92400e; }

[data-theme="dark"] .alert-success { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
[data-theme="dark"] .alert-error   { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
[data-theme="dark"] .alert-info    { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
[data-theme="dark"] .alert-warning { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }

/* ====== اصلی ====== */
.site-main {
    flex: 1;
    padding: 40px 0;
}

/* ====== کارت ====== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    max-width: 500px;
    margin: 0 auto;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 24px;
    text-align: center;
    color: var(--text);
}

/* ====== فرم ====== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg);
    color: var(--text);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    margin-top: 8px;
}

.form-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
}

.form-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* ====== فوتر ====== */
.site-footer {
    background: var(--bg-card);
    padding: 20px 0;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

.site-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* ====== ناحیه آپلود ====== */
.upload-area {
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    padding: 50px 20px;
    text-align: center;
    transition: var(--transition);
    background: var(--bg);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

[data-theme="dark"] .upload-area:hover,
[data-theme="dark"] .upload-area.dragover {
    background: rgba(99, 102, 241, 0.1);
}

/* ====== نوار پیشرفت ====== */
.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* ====== لیست فایل‌ها ====== */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}

.file-item-name {
    font-weight: 600;
    margin-bottom: 6px;
    word-break: break-all;
}

.file-item-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ====== لینک دانلود ====== */
.download-link-box {
    background: #f0f9ff;
    border: 2px solid #0ea5e9;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.download-link-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9rem;
    margin-top: 8px;
    background: var(--bg-card);
    color: var(--text);
}

[data-theme="dark"] .download-link-box {
    background: rgba(14, 165, 233, 0.1);
    border-color: #0ea5e9;
}

/* ====== انتخاب زمان انقضا ====== */
#expiry-select {
    background: var(--bg-card);
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
}

/* ====== صفحه اصلی - ویژگی‌ها ====== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.feature-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 16px;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text);
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ====== مراحل کار ====== */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

.step {
    text-align: center;
}

.step-number {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 auto 12px;
}

.step h4 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.step p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ====== صفحه دانلود ====== */
.file-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 24px 0;
}

.file-info-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
}

.file-info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.file-info-value {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

/* ====== استایل‌های ویژه Dark Mode ====== */
[data-theme="dark"] .site-header {
    background: #1e293b;
}

[data-theme="dark"] .stat-icon {
    opacity: 0.9;
}

/* ====== ریسپانسیو ====== */
@media (min-width: 768px) {
    .card form {
        display: grid;
        gap: 0;
    }
}

@media (max-width: 640px) {
    .header-inner {
        flex-direction: column;
        gap: 12px;
    }
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    .card {
        padding: 24px 20px;
    }
    h1 {
        font-size: 1.8rem !important;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .steps-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 500px) {
    .file-info-grid {
        grid-template-columns: 1fr;
    }
}
/* ====== منوی ناوبری و دکمه‌ها ====== */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* دکمه همبرگر - به طور پیش‌فرض (دسکتاپ) مخفی */
.menu-toggle {
    display: none;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    transition: var(--transition);
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ====== چیدمان دسکتاپ (بیشتر از 768px) ====== */
@media (min-width: 769px) {
    .header-inner {
        display: flex;
        align-items: center;
        gap: 20px;
    }
    
    .logo {
        flex-shrink: 0;
    }
    
    /* منوی اصلی - در دسکتاپ همیشه نمایش داده شود */
    .main-nav {
        display: flex !important;
        flex: 1;
        justify-content: flex-end;
        align-items: center;
        gap: 16px;
    }
    
    .header-actions {
        flex-shrink: 0;
    }
}

/* ====== چیدمان موبایل (768px و کمتر) ====== */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 0;
    }
    
    .logo {
        order: 1;
        flex: 1;
    }
    
    .header-actions {
        order: 2;
        margin-right: auto;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    /* منوی اصلی در موبایل مخفی - فقط با کلاس active نمایش داده شود */
    .main-nav {
        order: 3;
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }
    
    .main-nav.active {
        display: flex;
    }
    
    .main-nav a {
        padding: 12px 16px;
        border-radius: 8px;
        font-size: 1rem;
        text-align: right;
    }
    
    .main-nav a:hover {
        background: var(--bg);
    }
    
    .user-greeting {
        font-size: 1rem;
    }
    
    .btn-logout {
        color: var(--danger) !important;
    }
}