﻿/* ==================== Container & Layout ==================== */
.bulk-upload-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    box-sizing: border-box;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    transition: grid-template-columns 0.5s ease;
    align-items: start;
}

.content-grid.uploading {
    grid-template-columns: 1fr;
}

/* ==================== Upload Box ==================== */
.upload-box {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
}

.upload-box h4 {
    margin-top: 0;
    color: #333;
    margin-bottom: 20px;
}

#bulkUploadForm {
    width: 100%;
}

/* ==================== Form Elements ==================== */
.form-group-custom {
    margin-bottom: 20px;
}

.form-label-custom {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.input-custom {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.input-custom:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.input-custom:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Chrome, Safari, Edge, Opera - حذف فلش‌های number input */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox - حذف فلش‌های number input */
input[type="number"] {
    -moz-appearance: textfield;
}

/* ==================== Input with Unit ==================== */
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit .input-custom {
    flex: 1;
    padding-left: 50px; /* فضا برای واحد */
    box-sizing: border-box;
}

.input-unit {
    position: absolute;
    left: 15px;
    color: #666;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
    line-height: 1.4;
}

.text-muted {
    color: #6c757d !important;
}

/* ==================== File Input ==================== */
.file-input-wrapper {
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.file-input-wrapper:hover {
    border-color: #0056b3;
    background: #e7f1ff;
}

.browse-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.browse-btn:hover {
    background: #0056b3;
}

.file-status {
    color: #999;
    margin: 10px 0 0;
    font-size: 13px;
}

/* ==================== Preview Section ==================== */
.files-preview-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.files-preview-section.show {
    display: block;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.files-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.preview-item {
    text-align: center;
    cursor: pointer;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.preview-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    background: white;
    transition: all 0.3s ease;
}

.preview-image-wrapper:hover {
    border-color: #007bff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.2);
}

.preview-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preview-image-wrapper:hover .preview-overlay {
    opacity: 1;
}

.preview-hint {
    color: white;
    font-size: 24px;
}

.preview-info {
    margin-top: 8px;
}

.preview-filename {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 5px 0;
    color: #333;
}

.preview-filesize {
    font-size: 11px;
    color: #666;
    margin: 0;
}

/* ==================== Radio Options ==================== */
.radio-group-custom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.radio-option-custom {
    display: flex;
    align-items: center;
}

.form-check-input {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* ==================== Font Awesome Icons in Labels ==================== */
.form-check-label i {
    margin-left: 5px;
    color: #007bff;
}

.info-text i {
    margin-left: 8px;
    color: #007bff;
    width: 16px;
    text-align: center;
}

.warning-box i {
    margin-left: 8px;
    font-size: 16px;
}

/* ==================== Progress Section ==================== */
.progress-section {
    margin: 20px 0;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 8px;
    border: 2px solid #007bff;
    border-left: 5px solid #007bff;
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.progress-section.show {
    display: block;
    animation: slideDown 0.4s ease;
}

.progress-section h5 {
    margin-top: 0;
    color: #007bff;
    margin-bottom: 15px;
}

.progress-list {
    max-height: 400px;
    overflow-y: auto;
}

.progress-item {
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease;
}

.progress-filename {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.progress-status {
    color: #007bff;
    font-size: 12px;
    font-weight: 600;
}

.progress-bar-wrapper {
    width: 100%;
    height: 24px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: bold;
}

/* ==================== Submit Button ==================== */
.btn-upload {
    width: 100%;
    padding: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-upload:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-upload:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== Info Box ==================== */
.info-box {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border-left: 5px solid #007bff;
    transition: all 0.5s ease;
    width: 100%;
    box-sizing: border-box;
}

.info-box h4 {
    margin-top: 0;
    color: #007bff;
}

.info-text {
    color: #666;
    line-height: 1.6;
    margin: 10px 0;
    font-size: 14px;
}

.warning-box {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    color: #856404;
    border-left: 5px solid #ffc107;
}

/* ==================== Uploading State ==================== */
.content-grid.uploading .info-box {
    display: none !important;
}

.content-grid.uploading .form-group-custom {
    display: none !important;
}

/* Show only file input and progress during upload */
.content-grid.uploading .upload-box {
    grid-column: 1 / -1;
}

/* Hide file input wrapper during upload */
.content-grid.uploading .file-input-wrapper {
    display: none !important;
}

/* Hide radio options during upload */
.content-grid.uploading .radio-group-custom {
    display: none !important;
}

/* Hide input with unit during upload */
.content-grid.uploading .input-with-unit {
    display: none !important;
}

/* Hide submit button during upload */
.content-grid.uploading .btn-upload {
    display: none !important;
}

/* Show progress and preview sections */
.content-grid.uploading .progress-section.show,
.content-grid.uploading .files-preview-section.show {
    display: block !important;
}

/* ==================== Modal ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeInModal 0.3s ease;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: scaleUpModal 0.3s ease;
}

@keyframes scaleUpModal {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ==================== Notifications ==================== */
.error-notification,
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    padding: 15px;
    min-width: 350px;
    z-index: 9999;
    animation: slideInDown 0.3s ease;
    border-left: 4px solid #dc3545;
    transition: all 0.3s ease;
}

.notification-success {
    border-left-color: #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.notification-warning {
    border-left-color: #ffc107;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.notification-info {
    border-left-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.error-notification .notification-header,
.notification .notification-header {
    color: #dc3545;
    margin-bottom: 10px;
    font-weight: bold;
}

.notification-success .notification-header {
    color: #28a745;
}

.notification-warning .notification-header {
    color: #ffc107;
}

.notification-info .notification-header {
    color: #007bff;
}

.error-notification .notification-body,
.notification .notification-body {
    color: #666;
    font-size: 14px;
}

.error-notification .notification-body p,
.notification .notification-body p {
    margin: 5px 0;
}

.error-notification .notification-close,
.notification .notification-close {
    position: absolute;
    top: 10px;
    left: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}

.error-notification .notification-close:hover,
.notification .notification-close:hover {
    color: #dc3545;
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==================== Results Section ==================== */
.results-section {
    animation: fadeIn 0.4s ease;
}

.summary-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.summary-card h3 {
    margin-top: 0;
    color: #333;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.summary-item {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.summary-label {
    font-size: 12px;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
}

.summary-value.success {
    color: #28a745;
}

.action-buttons-main {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-download {
    flex: 1;
    min-width: 200px;
    padding: 15px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-download.primary {
    background: #28a745;
    color: white;
}

.btn-download.primary:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-download.secondary {
    background: #6c757d;
    color: white;
}

.btn-download.secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-icon {
    font-size: 18px;
}

.btn-text {
    flex: 1;
}

.files-list-section {
    margin-top: 30px;
}

.files-list-section h3 {
    color: #333;
    margin-bottom: 20px;
}

.files-table-wrapper {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.files-table {
    width: 100%;
    border-collapse: collapse;
}

.files-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.files-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

.files-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
}

.files-table tbody tr:hover {
    background: #f8f9fa;
}

.file-row {
    transition: background 0.2s ease;
}

.file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.file-icon {
    font-size: 16px;
}

.file-format {
    color: #666;
    font-size: 13px;
}

.file-size-original,
.file-size-final {
    color: #666;
    font-size: 13px;
}

.file-coefficient {
    color: #007bff;
    font-weight: 600;
}

.file-savings {
    text-align: center;
}

.savings-badge {
    display: inline-block;
    background: #d4edda;
    color: #155724;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.file-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-action {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 4px;
    background: #e9ecef;
    color: #495057;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-action:hover {
    background: #007bff;
    color: white;
}

.warning-note {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin-top: 30px;
    color: #856404;
    border-left: 5px solid #ffc107;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.warning-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.warning-note p {
    margin: 0;
    line-height: 1.5;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .radio-group-custom {
        grid-template-columns: 1fr;
    }

    .action-buttons-main {
        flex-direction: column;
    }

    .btn-download {
        min-width: auto;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .files-table {
        font-size: 12px;
    }

    .files-table th,
    .files-table td {
        padding: 8px;
    }

    .error-notification {
        min-width: auto;
        left: 10px;
        right: 10px;
    }
}
