/*============================================*/


/*          سیستم مدیریت فایل‌ها              */


/*              style.css - تمیز              */


/*============================================*/


/* ===== 1. فونت و متغیرها ===== */

@import url('../Vazirmatn.css');
:root {
    --primary: #343D3F;
    --primary-dark: #1E2729;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --dark: #1f2937;
    --gray: #6b7280;
    --light: #f3f4f6;
    --white: #ffffff;
    --border: #b3c0cc;
}


/* ===== 2. پایه ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn UI FD', Tahoma, sans-serif;
    min-height: 100vh;
    padding: 30px 20px;
    direction: rtl;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    background-size: 600% 600%;
    animation: svelte-eksiin-gradientShift 3s ease infinite;
    color: #fff;
    transition: all .3s ease;
}

@keyframes svelte-eksiin-gradientShift {
    0% {
        background-position: 0% 50%
    }
    50% {
        background-position: 100% 50%
    }
    to {
        background-position: 0% 50%
    }
}


/* ===== 3. کانتینر و هدر ===== */

.container {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.header {
    color: var(--white);
    padding: 30px;
    text-align: center;
    background: linear-gradient(220deg, #6366f1, #4f46e5, #00f5ff, #9e00ff);
    background-size: 600% 600%;
    animation: svelte-eksiin-gradientShift 100s ease infinite;
    color: #fff;
    transition: all .3s ease;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 700;
    text-shadow: -.5px .5px 0px #0000004f;
}

.header p {
    opacity: 0.9;
    font-size: 14px;
}


/* ===== 4. تب‌ها ===== */

.tabs {
    display: flex;
    background: var(--light);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 18px 15px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    background: var(--white);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
}

.tab-badge {
    background: var(--danger);
    color: var(--white);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
}


/* ===== 5. جستجو ===== */

.search-section {
    padding: 20px 30px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.search-box {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}


/* ===== 6. آپلود ===== */

.upload-section {
    padding: 30px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-bottom: 1px solid var(--border);
}

.upload-section h2 {
    color: var(--dark);
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.drop-zone {
    border: 3px dashed var(--primary);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    background: var(--white);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 16px;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-dark);
    background: rgba(99, 102, 241, 0.05);
    transform: scale(1.01);
}

.drop-zone-icon {
    font-size: 24px;
    margin-bottom: 0px;
}

.drop-zone-text {
    color: var(--gray);
    font-size: 16px;
    margin-bottom: 10px;
}

.drop-zone-hint {
    color: #9ca3af;
    font-size: 13px;
}

.urgent-hint {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.file-input {
    display: none;
}


/* ===== 7. فایل‌های انتخاب شده (چیپ‌ها) ===== */

.selected-files {
    margin-top: 20px;
    display: none;
}

.selected-files.show {
    display: block;
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px dashed var(--border);
}

.selected-files h3 {
    font-size: 14px;
    color: var(--dark);
    margin-bottom: 12px;
}

.file-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray);
    border: 1px solid #dee2e6;
    border-radius: 20px;
    margin: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}

.file-chip:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.file-chip.urgent {
    background: #dc3545 !important;
    color: white !important;
    border-color: #c82333 !important;
    animation: pulse-urgent 1s infinite;
}

.file-chip.urgent:hover {
    background: #c82333 !important;
}

.file-chip.urgent .file-chip-remove {
    color: white !important;
}

.file-chip-remove {
    margin-right: 5px;
    cursor: pointer;
    font-size: 16px;
    color: #999;
    transition: color 0.2s;
}

.file-chip-remove:hover {
    color: #dc3545;
}


/* ===== 8. دکمه‌های عملیات ===== */

.upload-actions {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.upload-btn {
    padding: 14px 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.upload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.upload-progress {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    display: none;
}

.upload-progress.show {
    display: block;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    width: 0%;
    transition: width 0.3s ease;
}

.btn-delete-all {
    padding: 10px 20px;
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-delete-all:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-download-all {
    padding: 10px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-download-selected {
    padding: 10px 20px;
    background: var(--success);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download-selected:hover {
    transform: translateY(-5px);
}


/* ===== 9. لیست فایل‌ها ===== */

.files-section {
    padding: 25px 30px;
}

.files-section .date-group {
    margin-bottom: 35px;
}

.files-section .date-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--light);
}

.files-section .date-badge {
    background: var(--primary);
    color: var(--white);
    padding: 8px 18px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
}

.files-section .file-count {
    color: var(--gray);
    font-size: 13px;
}


/* ===== 10. Grid فایل‌ها ===== */

.files-section .files-grid {
    display: grid;
    grid-template-columns: 1fr 130px 140px 150px;
    gap: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    color: var(--primary-dark);
}

.files-section .grid-header {
    display: contents;
}

.files-section .grid-header>div {
    background: var(--dark);
    color: var(--white);
    padding: 14px 15px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.files-section .grid-header>div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 64px;
}

.files-section .grid-header label {
    cursor: pointer;
    margin: 0;
}

.files-section .grid-row {
    display: contents;
    animation: fadeIn 0.4s ease forwards;
}

.files-section .grid-row>div {
    padding: 10px 16px;
    border-bottom: 1px dashed var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    font-size: 12px;
}

.files-section .grid-row:nth-child(even)>div {
    background: #fafafa;
}

.files-section .grid-row:hover>div {
    background: #f3f4f6;
}

.files-section .grid-row.downloaded>div {
    background: var(--success-light);
}

.files-section .grid-row.downloaded:hover>div {
    background: #a7f3d0;
}


/* ===== 11. اطلاعات فایل ===== */

.files-section .file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    direction: ltr;
}

.files-section .file-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.files-section .file-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: right;
    width: 100%;
}

.files-section .file-name {
    font-weight: 600;
    color: var(--dark);
    font-size: 12px;
    word-break: break-all;
    text-align: left;
    direction: ltr;
    text-shadow: -0.5px 0.5px #ffffff;
}

.files-section .file-meta {
    font-size: 12px;
    color: var(--gray);
    margin-top: 3px;
    text-align: left;
}


/* ===== 12. وضعیت فایل ===== */

.files-section .status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.files-section .status-badge.pending {
    background: #fef3c7;
    color: var(--warning);
}

.files-section .status-badge.completed {
    background: var(--success-light);
    color: var(--success);
}


/* ===== 13. دکمه‌های عملیات فایل ===== */

.files-section .action-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

.files-section .btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.files-section .btn-download {
    color: var(--success);
}

.files-section .btn-download:hover {
    transform: translateY(-5px);
}

.files-section .btn-download.loading {
    pointer-events: none;
    opacity: 0.7;
}

.files-section .btn-delete {
    color: var(--danger);
}

.files-section .btn-delete:hover {
    transform: translateY(-5px);
    color: var(--danger);
}


/* ===== 14. چک‌باکس ===== */

.files-section .file-checkbox,
.files-section #selectAll {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}


/* ===== 15. صفحه‌بندی ===== */

.pagination-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--light);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    font-size: 14px;
    color: var(--gray);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.per-page-select {
    padding: 8px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    background: var(--white);
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ===== 16. حالت خالی ===== */

.files-section .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.files-section .empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.4;
}

.files-section .empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--dark);
}


/* ===== 17. لودینگ ===== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}


/* ===== 18. فوری (Urgent) ===== */

.urgent-row {
    background: #fff0f0 !important;
    border-right: 4px solid #dc3545 !important;
    transition: all 0.3s ease;
}

.urgent-row:hover {
    background: #ffe6e6 !important;
}

.urgent-row .file-name {
    color: #c82333;
    font-weight: bold;
}

.urgent-row .file-icon::before {
    content: '🚀';
    margin-left: 5px;
}

.status-badge.urgent {
    background: #dc3545 !important;
    color: white !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    animation: badge-pulse 2s infinite;
}

.status-badge.urgent .badge-icon {
    fill: white !important;
}

.tab-btn[data-tab="urgent"] .tab-icon {
    fill: #dc3545;
}

.tab-btn[data-tab="urgent"]:hover .tab-icon {
    fill: #c82333;
}


/* ===== 19. آیکون‌ها ===== */

.icon-missing {
    color: #dc3545;
    font-size: 10px;
    font-weight: bold;
}

.tab-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-left: 6px;
}

.header-icon {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    margin-left: 8px;
}

.section-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-left: 8px;
}

.search-icon-svg {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    fill: #999;
}

.btn-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-left: 6px;
}

.drop-icon {
    width: 60px;
    height: 60px;
    fill: #e8b142;
}

.file-icon-svg {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    fill: #6c757d;
}

.meta-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-left: 4px;
}

.badge-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-left: 4px;
}

.action-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-icon svg {
    width: 100%;
    height: 100%;
}

.empty-icon {
    width: 80px;
    height: 80px;
    fill: #000000;
    margin-bottom: 15px;
}


/* اندازه‌های آیکون */

.icon-xs {
    width: 12px !important;
    height: 12px !important;
}

.icon-sm {
    width: 16px !important;
    height: 16px !important;
}

.icon-md {
    width: 24px !important;
    height: 24px !important;
}

.icon-lg {
    width: 32px !important;
    height: 32px !important;
}

.icon-xl {
    width: 48px !important;
    height: 48px !important;
}


/* رنگ‌های آیکون */

.icon-primary {
    fill: #007bff !important;
}

.icon-success {
    fill: #28a745 !important;
}

.icon-danger {
    fill: #dc3545 !important;
}

.icon-warning {
    fill: #ffc107 !important;
}

.icon-info {
    fill: #17a2b8 !important;
}

.icon-secondary {
    fill: #6c757d !important;
}

.icon-light {
    fill: #f8f9fa !important;
}

.icon-dark {
    fill: #343a40 !important;
}


/* انیمیشن آیکون */

.icon-spin {
    animation: icon-spin 1s linear infinite;
}

.icon-pulse {
    animation: icon-pulse 1.5s ease-in-out infinite;
}


/* Hover آیکون */

.btn:hover .action-icon svg {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.btn-download:hover .action-icon svg {
    fill: #28a745;
}

.btn-delete:hover .action-icon svg {
    fill: #dc3545;
}


/* ===== 20. انیمیشن‌ها ===== */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes pulse-urgent {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(220, 53, 69, 0);
    }
}

@keyframes badge-pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes icon-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes icon-pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}


/* ===== 21. ریسپانسیو ===== */

@media (max-width: 768px) {
    .files-section .files-grid {
        grid-template-columns: 1fr;
    }
    .files-section .grid-header {
        display: none;
    }
    .files-section .grid-row>div {
        padding: 12px 15px;
    }
    .files-section .grid-row>div::before {
        content: attr(data-label) ': ';
        font-weight: 600;
        color: var(--gray);
        margin-left: 10px;
        min-width: 80px;
    }
    .files-section .action-btns {
        flex-direction: column;
    }
    .drop-zone {
        padding: 30px 20px;
    }
    .pagination-section {
        flex-direction: column;
        text-align: center;
    }
}