/* ==========================================================================
   1. GLOBAL STYLES & RESETS (اعمال روی کل سایت)
   ========================================================================== */
/* @import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css'); */

:root {
    --primary-color: #0d6efd;
    --bg-color: #f3f6f9;
}

[v-cloak] { display: none !important; }

body {
    /* font-family: 'Vazirmatn', sans-serif; */
    background-color: var(--bg-color);
    color: #495057;
    line-height: 1.7;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    padding-bottom: 100px; /* فضای خالی برای فوتر ثابت */
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar Styling */
body::-webkit-scrollbar { width: 10px; }
body::-webkit-scrollbar-track { background: #e9ecef; }
body::-webkit-scrollbar-thumb { background-color: #bdc3c7; border-radius: 6px; border: 2px solid #e9ecef; }
body::-webkit-scrollbar-thumb:hover { background-color: #3498db; }

/* Global Utilities */
.super-small { font-size: 0.75rem; }
.object-fit-cover { object-fit: cover; }

/* Vue Transitions */
.fade-enter-active, .fade-leave-active { transition: opacity 0.3s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* =========================================
   2. SHARED COMPONENTS (Loader, Toast, Footer)
   ========================================= */

/* Page Loader */
#page-loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #fff;
    z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s ease;
}
.spinner {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: 9px solid #dbdcef;
    border-right-color: #474bff;
    animation: spin 1s infinite linear;
}
@keyframes spin { to { transform: rotate(1turn); } }

/* Fixed Footer Navbar */
.fixed-footer {
    position: fixed; bottom: 0; left: 0; width: 100%;
    bottom: env(keyboard-inset-height, 0); /* iOS fix */
    background-color: #fff;
    border-top: 1px solid #dee2e6;
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 1000;
}
.footer-btn {
    color: #6c757d;
    transition: all 0.2s ease;
}
.footer-btn:hover {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}
.footer-btn.active {
    color: var(--primary-color);
    font-weight: 500;
}
.center-action-btn {
    transition: all 0.3s ease;
}
.center-action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.4) !important;
}

/* PWA Install Toast */
.toast-container { z-index: 1090; }
#pwa-install-toast.showing { animation: slide-up 0.5s ease-out forwards; }
#pwa-install-toast.hiding { animation: slide-down 0.5s ease-in forwards; }

@keyframes slide-up {
    from { transform: translate(-50%, 150%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}
@keyframes slide-down {
    from { transform: translate(-50%, 0); opacity: 1; }
    to { transform: translate(-50%, 150%); opacity: 0; }
}

/* Modal Customization */
.modal-content {
    border-radius: 1rem; border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.modal-lg { max-width: 900px; }

/* ==========================================================================
   3. GALLERY PAGE STYLES (Scoped to #spa-gallery-page)
   ========================================================================== */
#spa-gallery-page .page-header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: #fff;
    padding: 4rem 0;
    margin-bottom: 3.5rem;
    border-bottom-left-radius: 35px;
    border-bottom-right-radius: 35px;
    box-shadow: 0 15px 35px -10px rgba(52, 152, 219, 0.4);
    position: relative;
    overflow: hidden;
}
#spa-gallery-page .page-header::before {
    content: ''; position: absolute; top: -30%; right: -5%;
    width: 300px; height: 300px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 50%; pointer-events: none;
}
#spa-gallery-page .page-header h2 {
    font-size: 2.2rem; margin-bottom: 0.75rem !important;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
#spa-gallery-page .page-header p {
    font-size: 1.1rem; font-weight: 300; color: rgba(255, 255, 255, 0.9);
}

/* Filters */
#spa-gallery-page .filter-bar-wrapper {
    overflow-x: auto; overflow-y: hidden; white-space: nowrap; padding-bottom: 5px;
}
#spa-gallery-page .filter-bar { flex-wrap: nowrap !important; }

/* Gallery Card */
#spa-gallery-page .gallery-card {
    background: #fff; border: none; border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%; display: flex; flex-direction: column;
}
#spa-gallery-page .gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

/* Card Header (Insta Style) */
#spa-gallery-page .card-header-insta {
    background: #fff; padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex; align-items: center;
}
#spa-gallery-page .css-avatar {
    width: 40px; height: 40px; border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid #fff;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: bold; flex-shrink: 0;
}
#spa-gallery-page .school-name {
    color: #2c3e50; font-weight: 700; font-size: 0.9rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#spa-gallery-page .school-meta { font-size: 0.75rem; color: #95a5a6; }

/* Media & Swiper */
#spa-gallery-page .card-swiper {
    margin: 0; width: 100%; position: relative; background-color: #f1f5f9;
}
#spa-gallery-page .media-container {
    width: 100%; height: 280px; background-color: #000;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
#spa-gallery-page .media-container img { width: 100%; height: 100%; object-fit: cover; }
#spa-gallery-page .media-container video { width: 100%; height: 100%; object-fit: contain; }

#spa-gallery-page .swiper-pagination-bullet { background: rgba(255, 255, 255, 0.8) !important; opacity: 0.6; }
#spa-gallery-page .swiper-pagination-bullet-active {
    background: #fff !important; opacity: 1 !important;
    box-shadow: 0 0 2px rgba(0,0,0,0.5); width: 20px; border-radius: 4px;
}

/* Card Body */
#spa-gallery-page .card-body {
    flex: 1; padding: 18px; display: flex; flex-direction: column;
}
#spa-gallery-page .card-title {
    color: #2c3e50; font-size: 1.05rem; font-weight: 700; margin-bottom: 0.75rem;
}
#spa-gallery-page .card-desc {
    font-size: 0.9rem; color: #6c757d; line-height: 1.6;
    max-height: 4.5em; overflow: hidden; transition: max-height 0.3s ease;
}
#spa-gallery-page .card-desc.expanded { max-height: 500px; }
#spa-gallery-page .read-more-link {
    color: #3498db; font-weight: 600; font-size: 0.8rem;
    margin-top: 8px; cursor: pointer; text-decoration: none;
}
#spa-gallery-page .card-footer-meta {
    border-top: 1px dashed #eee; padding-top: 12px; margin-top: auto;
    font-size: 0.75rem; color: #95a5a6;
}

/* ==========================================================================
   4. UPLOAD PAGE STYLES (Scoped to #spa-upload-page)
   ========================================================================== */
   
/* Stepper */
#spa-upload-page .stepper-wrapper {
    display: flex; justify-content: space-between; margin-bottom: 20px; position: relative;
}
#spa-upload-page .stepper-item {
    position: relative; display: flex; flex-direction: column; align-items: center; flex: 1;
}
#spa-upload-page .stepper-item::before {
    position: absolute; content: ""; border-bottom: 2px solid #ccc;
    width: 100%; top: 20px; right: -50%; z-index: 2;
}
#spa-upload-page .stepper-item:first-child::before { display: none; }

#spa-upload-page .stepper-item .step-counter {
    position: relative; z-index: 5;
    display: flex; justify-content: center; align-items: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: #ccc; margin-bottom: 6px; color: white;
    font-weight: bold; transition: background-color 0.5s ease;
}
#spa-upload-page .stepper-item .step-name {
    font-size: 0.85rem; color: #6c757d; transition: color 0.5s ease;
}
#spa-upload-page .stepper-item.active .step-counter { background-color: var(--primary-color); }
#spa-upload-page .stepper-item.active .step-name { color: var(--primary-color); font-weight: bold; }
#spa-upload-page .stepper-item.completed .step-counter { background-color: #198754; }
#spa-upload-page .stepper-item.completed .step-name { color: #198754; }

/* Lists & Inputs */
#spa-upload-page .list-group-item { cursor: pointer; }
#spa-upload-page .list-group-item:hover { background-color: #f8f9fa; }
#spa-upload-page .school-list { max-height: 250px; overflow-y: auto; }

/* Drop Zone */
#spa-upload-page .drop-zone {
    border: 2px dashed #6c757d; border-radius: 12px;
    background: linear-gradient(145deg, #fdfdfd, #f1f3f6);
    padding: 2.5rem; text-align: center; color: #6c757d;
    font-weight: 500; cursor: pointer; transition: all 0.25s ease; position: relative;
}
#spa-upload-page .drop-zone.drag-over {
    background-color: #e3f2fd; border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2);
}
#spa-upload-page .drop-zone input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

/* File Cards */
#spa-upload-page .file-card {
    position: relative; background: #fff; border-radius: 10px;
    overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}
#spa-upload-page .file-card:hover { transform: translateY(-3px); }
#spa-upload-page .file-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
#spa-upload-page .file-info {
    padding: 0.4rem 0.6rem; font-size: 0.8rem; text-align: center; color: #495057; word-break: break-word;
}
#spa-upload-page .file-card .remove-file-btn {
    position: absolute; top: 5px; right: 5px;
    border-radius: 50%; width: 26px; height: 26px;
    display: flex; justify-content: center; align-items: center;
    font-weight: bold; line-height: 1; z-index: 10;
}

/* Status Overlay */
#spa-upload-page .file-status-overlay {
    position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6);
    color: #fff; font-weight: 500; font-size: 0.95rem;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
}
#spa-upload-page .file-card[data-status="compressing"] .file-status-overlay {
    opacity: 1; animation: pulse 1s infinite;
}
#spa-upload-page .file-card[data-status="uploading"] .file-status-overlay,
#spa-upload-page .file-card[data-status="complete"] .file-status-overlay,
#spa-upload-page .file-card[data-status="error"] .file-status-overlay { opacity: 1; }

#spa-upload-page .file-card[data-status="error"] .file-status-overlay { background: rgba(220, 53, 69, 0.8); }
#spa-upload-page .file-card[data-status="complete"] .file-status-overlay { background: rgba(25, 135, 84, 0.8); }

@keyframes pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

#spa-upload-page .file-progress {
    width: 0%; height: 4px; background-color: var(--primary-color); transition: width 0.3s ease;
}

/* Final Review Preview */
#spa-upload-page .final-preview-grid {
    display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; justify-content: flex-start;
}
#spa-upload-page .final-preview-item {
    position: relative; width: 100px; height: 100px; border-radius: 8px;
    overflow: hidden; cursor: pointer; border: 1px solid #dee2e6; background-color: #f8f9fa;
}
#spa-upload-page .final-preview-item img { width: 100%; height: 100%; object-fit: cover; }
#spa-upload-page .final-preview-item .play-icon {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 2.5rem; color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}
/* Preview Modal Specifics */
#previewModal .modal-body { padding: 0; text-align: center; background: #000; }
#previewModal .modal-body img, #previewModal .modal-body video {
    max-width: 100%; max-height: 80vh; display: block; margin: 0 auto;
}