/* ============================================
   فونت یکپارچه
   ============================================ */
@import url('fonts.css');

/* ============================================
   تنظیمات پایه
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', 'IRANSans', 'Tahoma', 'Arial', sans-serif;
    background: #f4f6f8;
    color: #333;
    direction: rtl;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

.header {
    background: #1a73e8;
    color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.header h1 {
    font-size: 22px;
    font-weight: 700;
}
.user-info {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-logout {
    background: #dc3545;
    color: #fff;
    padding: 5px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}
.btn-logout:hover {
    background: #c82333;
}

.nav {
    background: #fff;
    padding: 12px 20px;
    margin-top: 15px;
    margin-bottom: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.summary-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.filter-bar {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
}

.nav a {
    color: #1a73e8;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 5px;
    transition: all 0.3s;
    font-weight: 500;
}
.nav a:hover {
    background: #e8f0fe;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 25px;
}
.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}
.stat-card h3 {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}
.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: #1a73e8;
}

.welcome-msg {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    margin-top: 25px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.welcome-msg h2 {
    color: #1a73e8;
    margin-bottom: 10px;
    font-weight: 700;
}

.alert {
    padding: 12px 18px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-weight: 400;
}
.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-top: 15px;
}
table th {
    background: #1a73e8;
    color: #fff;
    padding: 12px 15px;
    text-align: right;
    font-weight: 600;
}
table td {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}
table tr:hover {
    background: #f8f9fa;
}

.btn {
    display: inline-block;
    padding: 8px 18px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}
.btn:hover {
    background: #1557b0;
}
.btn-danger {
    background: #dc3545;
}
.btn-danger:hover {
    background: #c82333;
}
.btn-success {
    background: #28a745;
}
.btn-success:hover {
    background: #218838;
}
.btn-warning {
    background: #ffc107;
    color: #333;
}
.btn-warning:hover {
    background: #e0a800;
}

.form-container {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-top: 20px;
}
.form-container h3 {
    font-weight: 700;
    color: #1a73e8;
    margin-bottom: 15px;
}
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}
.form-group textarea {
    height: 80px;
    resize: vertical;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* استایل برای فیلد توضیحات در حالت خطا */
.form-group .error-input {
    border-color: #dc3545 !important;
    background-color: #fff8f8;
}

.form-group .error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.form-group .error-message.show {
    display: block;
}

/* استایل برای ستاره الزامی */
.required-star {
    color: #dc3545;
    display: none;
}

.required-star.show {
    display: inline;
}

/* ============================================
   مودال جزئیات - استایل پیشرفته
   ============================================ */
.modal-details {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 60000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalSlideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-details-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 30px;
    border-radius: 16px;
    max-width: 850px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    animation: modalSlideDown 0.4s ease;
    border: 1px solid rgba(255,255,255,0.2);
}

/* اسکرول‌بار سفارشی برای مودال */
.modal-details-content::-webkit-scrollbar {
    width: 6px;
}

.modal-details-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-details-content::-webkit-scrollbar-thumb {
    background: #c1c7cd;
    border-radius: 10px;
}

.modal-details-content::-webkit-scrollbar-thumb:hover {
    background: #a8b0b8;
}

/* هدر مودال */
.modal-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-details-header .modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-details-header .modal-title .icon {
    font-size: 28px;
    background: #e8f0fe;
    padding: 8px;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-details-header .modal-title h3 {
    margin: 0;
    color: #1a73e8;
    font-size: 20px;
    font-weight: 700;
}

.modal-details-header .modal-title .receipt-badge {
    background: #e8f0fe;
    color: #1a73e8;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.modal-details-header .close-btn {
    background: #f1f3f5;
    color: #495057;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 18px;
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-details-header .close-btn:hover {
    background: #dc3545;
    color: #fff;
    transform: rotate(90deg);
}

/* بخش اطلاعات اصلی رسید */
.receipt-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    background: #fff;
    padding: 18px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.receipt-info-grid .info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.receipt-info-grid .info-item .label {
    font-size: 11px;
    color: #868e96;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.receipt-info-grid .info-item .value {
    font-size: 15px;
    color: #212529;
    font-weight: 600;
}

.receipt-info-grid .info-item .value.highlight {
    color: #1a73e8;
}

.receipt-info-grid .info-item .value.success {
    color: #28a745;
}

.receipt-info-grid .info-item .value.danger {
    color: #dc3545;
}

.receipt-info-grid .info-item .value.warning {
    color: #ffc107;
}

/* بخش جداول */
.details-section {
    margin-top: 20px;
}

.details-section .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    padding: 10px 15px;
    border-radius: 8px;
}

.details-section .section-title.consumption {
    background: #fff5f5;
    color: #dc3545;
    border-right: 4px solid #dc3545;
}

.details-section .section-title.transfer {
    background: #fff8f0;
    color: #ff9800;
    border-right: 4px solid #ff9800;
}

.details-section .empty-message {
    text-align: center;
    padding: 30px;
    color: #868e96;
    font-size: 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
}

.details-section .empty-message .icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

/* جدول جزئیات */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.detail-table thead {
    background: #f8f9fa;
}

.detail-table th {
    background: #f8f9fa;
    color: #212529 !important;  /* ← این خط مهم است */
    padding: 12px 10px;
    text-align: center;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-table td {
    padding: 10px 10px;
    text-align: center;
    border-bottom: 1px solid #f1f3f5;
    color: #212529;
    font-size: 14px;
}

.detail-table tr:hover td {
    background: #f8f9fa;
}

.detail-table tr:last-child td {
    border-bottom: none;
}

.detail-table .badge-reason {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.detail-table .badge-reason.broken {
    background: #f8d7da;
    color: #721c24;
}

.detail-table .badge-reason.repair {
    background: #fff3cd;
    color: #856404;
}

.detail-table .badge-reason.consumption {
    background: #d4edda;
    color: #155724;
}

.detail-table .badge-reason.other {
    background: #e2e3e5;
    color: #383d41;
}

/* استایل برای شماره انتقال در جدول */
.detail-table .transfer-number {
    color: #1a73e8;
    font-weight: 600;
}

.detail-table .quantity-number {
    font-weight: 700;
}

.detail-table .quantity-number.success {
    color: #28a745;
}

.detail-table .quantity-number.danger {
    color: #dc3545;
}

/* پاسخ‌گویی */
@media (max-width: 768px) {
    .modal-details-content {
        padding: 20px;
        max-width: 95%;
    }
    
    .receipt-info-grid {
        grid-template-columns: 1fr 1fr;
        padding: 12px;
    }
    
    .modal-details-header .modal-title h3 {
        font-size: 16px;
    }
    
    .detail-table {
        font-size: 12px;
    }
    
    .detail-table th,
    .detail-table td {
        padding: 6px 4px;
    }
}

@media (max-width: 480px) {
    .receipt-info-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-details-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .modal-details-header .close-btn {
        align-self: flex-end;
    }
    
    .detail-table {
        font-size: 11px;
    }
    
    .detail-table th,
    .detail-table td {
        padding: 4px 3px;
    }
}

/* ============================================
   دکمه جزئیات در جدول
   ============================================ */
.btn-details {
    background: #17a2b8;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-details:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

.btn-details:active {
    transform: translateY(0);
}

/* استایل برای دکمه عکس */
.btn-view-receipt-image {
    background: #8e44ad;
    color: #fff !important;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    transition: all 0.3s ease;
}

.btn-view-receipt-image:hover {
    background: #732d91;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.4);
}

.receipt-number {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #1a73e8;
    background: #e8f0fe;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    direction: ltr;
    display: inline-block;
}