* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Rubik', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.app {
    max-width: 1600px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    padding: 20px 20px 30px 20px;
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-family: 'Rubik', sans-serif;
    font-weight: bold;
}

.header p {
    font-family: 'Rubik', sans-serif;
    opacity: 0.9;
}

/* ========== لایه‌بندی اصلی با سایدبار ========== */
.layout-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* سایدبار منو */
.sidebar-menu {
    flex: 0 0 260px;
    background: white;
    border-radius: 20px;
    padding: 20px 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.menu-header {
    padding: 0 20px 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 15px;
}

.menu-header h3 {
    color: #4f46e5;
    font-size: 1.1rem;
    font-weight: bold;
}

.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s;
    color: #4b5563;
    font-family: 'Rubik', sans-serif;
    border-right: 3px solid transparent;
}

.menu-item:hover {
    background: #f3f4f6;
    color: #4f46e5;
}

.menu-item.active {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    color: #4f46e5;
    border-right-color: #4f46e5;
}

.menu-icon {
    font-size: 1.3rem;
}

.menu-text {
    font-size: 0.95rem;
    font-weight: 500;
}

/* محتوای اصلی */
.main-container {
    flex: 1;
    min-width: 300px;
}

/* صفحات مختلف */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* ========== کارت‌ها و المان‌های عمومی ========== */
.card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.card h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
    font-family: 'Rubik', sans-serif;
    font-weight: bold;
    border-right: 4px solid #4f46e5;
    padding-right: 15px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.card-header h2 {
    margin-bottom: 0;
    border-right: none;
    padding-right: 0;
}

/* دو ستونه - سایدبار راست و محتوای اصلی (برای صفحه کراول) */
.two-columns {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.sidebar-right {
    flex: 0 0 35%;
    min-width: 280px;
}

.main-content {
    flex: 1;
    min-width: 300px;
}

/* ========== دکمه‌ها ========== */
.btn-primary-sm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Rubik', sans-serif;
}

.btn-primary-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary, .btn-success, .btn-secondary, .btn-info, .btn-danger {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Rubik', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-info {
    background: #1076b9;
    color: white;
}

.btn-info:hover {
    background: #0b5a8f;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #dc2626;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Rubik', sans-serif;
    width: auto;
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.4);
}

.button-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
}

/* ========== فرم‌ها و ورودی‌ها ========== */
.select-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Rubik', sans-serif;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.select-input:hover {
    border-color: #4f46e5;
}

.select-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #374151;
    font-family: 'Rubik', sans-serif;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Rubik', sans-serif;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: 'Rubik', sans-serif;
}

.radio-label input {
    cursor: pointer;
}

/* ========== جدول‌ها ========== */
.table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #e5e7eb;
    font-family: 'Rubik', sans-serif;
    font-size: 0.85rem;
}

.data-table th {
    background: #f3f4f6;
    font-weight: bold;
    color: #374151;
    position: sticky;
    top: 0;
}

.data-table tr:hover {
    background: #f9fafb;
}

/* ========== دکمه‌های عملیاتی در جدول ========== */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-edit, .btn-delete {
    padding: 5px 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: 'Rubik', sans-serif;
    transition: all 0.2s;
}

.btn-edit {
    background: #e0e7ff;
    color: #4f46e5;
}

.btn-edit:hover {
    background: #c7d2fe;
}

.btn-delete {
    background: #fee2e2;
    color: #dc2626;
}

.btn-delete:hover {
    background: #fecaca;
}

/* ========== وضعیت‌ها و نشانگرها ========== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}

.badge-success {
    background: #d1fae5;
    color: #059669;
}

.badge-warning {
    background: #fed7aa;
    color: #c2410c;
}

.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.badge-info {
    background: #e0e7ff;
    color: #4f46e5;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: #9ca3af;
    font-family: 'Rubik', sans-serif;
}

/* ========== پیشرفت ========== */
.progress-bar {
    width: 100%;
    height: 30px;
    background: #e5e7eb;
    border-radius: 15px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-family: 'Rubik', sans-serif;
}

.status-message {
    margin-top: 15px;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: 'Rubik', sans-serif;
}

/* ========== مودال ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    color: #333;
    font-size: 1.2rem;
    font-weight: bold;
}

.modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s;
}

.modal-close:hover {
    color: #dc2626;
}

.modal-body {
    padding: 20px 25px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 15px 25px 20px 25px;
    border-top: 1px solid #e5e7eb;
}

.modal-footer button {
    flex: 1;
    margin-top: 0;
}

/* ========== داشبورد ========== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.stat-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #4f46e5;
    font-family: 'Rubik', sans-serif;
}

.stat-label {
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ========== اطلاعات و پیغام‌ها ========== */
.info-text {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
    font-family: 'Rubik', sans-serif;
}

.error-message {
    color: #dc2626;
    padding: 12px;
    background: #fee2e2;
    border-radius: 10px;
    margin-top: 10px;
    text-align: center;
    font-family: 'Rubik', sans-serif;
}

.success-message {
    color: #059669;
    padding: 12px;
    background: #d1fae5;
    border-radius: 10px;
    margin-top: 10px;
    text-align: center;
    font-family: 'Rubik', sans-serif;
}

.result-stats {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    text-align: center;
}

.result-stats p {
    margin: 5px 0;
    font-family: 'Rubik', sans-serif;
}

.result-stats .count {
    font-size: 2rem;
    font-weight: bold;
}

.file-info {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
}

.file-info p {
    margin: 5px 0;
    color: #166534;
}

/* ========== فوتر ========== */
.footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 20px;
}

.footer a {
    color: #ff9800;
    text-decoration: none;
    font-weight: bold;
    font-family: 'Rubik', sans-serif;
}

.footer a:hover {
    text-decoration: underline;
}

.footer div {
    font-family: 'Rubik', sans-serif;
    margin: 5px 0;
}

.developer-info {
    margin-top: 10px;
    font-size: 0.75rem;
    opacity: 0.8;
}

.developer-name {
    font-size: 0.9rem;
    font-weight: bold;
    margin: 8px 0;
}

/* ========== استایل‌های ویژه صف ========== */
.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 8px;
    border-right: 3px solid #4f46e5;
    transition: all 0.2s;
}
.queue-item:hover {
    background: #f1f5f9;
    transform: translateX(-3px);
}
.queue-item .q-info {
    font-size: 0.9rem;
    color: #334155;
}
.queue-item .q-info strong {
    color: #4f46e5;
}
.queue-item .q-meta {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
}
.queue-item .q-actions button {
    padding: 4px 10px;
    font-size: 0.75rem;
    margin-right: 5px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.status-running {
    animation: pulse 2s infinite;
    color: #059669;
    font-weight: bold;
    display: inline-block;
    margin-top: 5px;
}

/* ========== ریسپانسیو ========== */
@media (max-width: 992px) {
    .layout-container {
        flex-direction: column;
    }
    
    .sidebar-menu {
        flex: 1;
        position: static;
    }
    
    .menu-list {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .menu-item {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        border-right: none;
        border-bottom: 3px solid transparent;
    }
    
    .menu-item.active {
        border-right-color: transparent;
        border-bottom-color: #4f46e5;
    }
}

@media (max-width: 768px) {
    .two-columns {
        flex-direction: column;
    }
    
    .sidebar-right {
        flex: 1;
    }
    
    .main-content {
        flex: 1;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 15px;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .menu-item {
        min-width: 100px;
        padding: 10px;
    }
    
    .menu-text {
        font-size: 0.8rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
}

.custom-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    min-width: 280px;
    max-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    overflow: hidden;
    direction: rtl;
}

.custom-toast.show {
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    color: #333;
}

.toast-progress {
    height: 3px;
    background: #4f46e5;
    width: 100%;
    animation: toastProgress 3s linear forwards;
}

.toast-success .toast-progress { background: #10b981; }
.toast-error .toast-progress { background: #dc2626; }
.toast-warning .toast-progress { background: #f59e0b; }
.toast-info .toast-progress { background: #3b82f6; }

@keyframes toastProgress {
    0% { width: 100%; }
    100% { width: 0%; }
}

.custom-confirm {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.custom-confirm.show {
    visibility: visible;
    opacity: 1;
}

.confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.confirm-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.custom-confirm.show .confirm-content {
    transform: scale(1);
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
}

.confirm-icon {
    font-size: 1.8rem;
}

.confirm-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
}

.confirm-body {
    padding: 25px;
    text-align: center;
}

.confirm-body p {
    margin: 0;
    color: #555;
    font-size: 1rem;
    line-height: 1.5;
}

.confirm-footer {
    display: flex;
    gap: 12px;
    padding: 15px 25px 20px 25px;
    border-top: 1px solid #e5e7eb;
}

.confirm-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-cancel {
    background: #f3f4f6;
    color: #6b7280;
}

.confirm-cancel:hover {
    background: #e5e7eb;
}

.confirm-ok {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.confirm-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}