/* ========================================
   Batch Print Modal Styles
   ======================================== */

/* Modal Overlay */
.batch-print-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.batch-print-overlay.active {
    display: block;
    opacity: 1;
}

/* Modal Container */
.batch-print-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: none;
    opacity: 0;
    transition: all 0.3s ease;
}

.batch-print-modal.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.batch-print-header {
    background: linear-gradient(135deg, #0d0e51 0%, #1a1b7a 100%);
    color: #fff;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.batch-print-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.batch-print-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.batch-print-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Modal Body */
.batch-print-body {
    padding: 25px;
    max-height: calc(90vh - 150px);
    overflow-y: auto;
}

/* Method Selection Tabs */
.batch-method-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.batch-method-tab {
    flex: 1;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #f8f9fa;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}

.batch-method-tab:hover {
    border-color: #0d0e51;
    background: #f0f1ff;
}

.batch-method-tab.active {
    border-color: #0d0e51;
    background: linear-gradient(135deg, #0d0e51 0%, #1a1b7a 100%);
    color: #fff;
}

.batch-method-tab i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.batch-method-tab span {
    font-size: 1rem;
    font-weight: 600;
}

/* Content Sections */
.batch-content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.batch-content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Excel Upload Section */
.excel-upload-zone {
    border: 3px dashed #ccc;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.excel-upload-zone:hover,
.excel-upload-zone.dragover {
    border-color: #0d0e51;
    background: #f0f1ff;
}

.excel-upload-zone i {
    font-size: 4rem;
    color: #0d0e51;
    margin-bottom: 15px;
}

.excel-upload-zone p {
    margin: 10px 0;
    color: #666;
}

.excel-upload-zone .btn-upload {
    background: linear-gradient(135deg, #0d0e51 0%, #1a1b7a 100%);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 15px;
    transition: transform 0.2s;
}

.excel-upload-zone .btn-upload:hover {
    transform: scale(1.05);
}

#excelFileInput {
    display: none;
}

.excel-template-link {
    margin-top: 15px;
    display: block;
    color: #0d0e51;
    text-decoration: underline;
    cursor: pointer;
}

/* Generator Section */
.generator-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
}

.generator-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.generator-field {
    flex: 1;
    min-width: 200px;
}

.generator-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.generator-field input,
.generator-field select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.generator-field input:focus,
.generator-field select:focus {
    outline: none;
    border-color: #0d0e51;
}

.date-mode-options {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.date-mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.date-mode-option input[type="radio"] {
    width: auto;
}

/* Preview Table */
.batch-preview-container {
    margin-top: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.batch-preview-header {
    background: #f0f1ff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.batch-preview-header h4 {
    margin: 0;
    color: #0d0e51;
}

.batch-preview-count {
    background: #0d0e51;
    color: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.batch-preview-table {
    max-height: 300px;
    overflow-y: auto;
}

.batch-preview-table table {
    width: 100%;
    border-collapse: collapse;
}

.batch-preview-table th,
.batch-preview-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #e0e0e0;
}

.batch-preview-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
}

.batch-preview-table tr:hover {
    background: #f0f1ff;
}

.batch-preview-table .row-number {
    width: 50px;
    text-align: center;
    color: #666;
}

.batch-preview-table .delete-row {
    color: #dc3545;
    cursor: pointer;
    padding: 5px;
}

.batch-preview-table .delete-row:hover {
    color: #a71d2a;
}

/* Print Settings */
.print-settings {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 20px;
    margin-top: 25px;
}

.print-settings h4 {
    margin: 0 0 15px 0;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 10px;
}

.print-settings-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.print-setting-item {
    flex: 1;
    min-width: 150px;
}

.print-setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.print-setting-item input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

/* Action Buttons */
.batch-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    justify-content: flex-end;
}

.batch-btn {
    padding: 14px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.batch-btn-primary {
    background: linear-gradient(135deg, #0d0e51 0%, #1a1b7a 100%);
    color: #fff;
}

.batch-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(13, 14, 81, 0.3);
}

.batch-btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e0e0e0;
}

.batch-btn-secondary:hover {
    background: #e9ecef;
}

.batch-btn-danger {
    background: #dc3545;
    color: #fff;
}

.batch-btn-danger:hover {
    background: #c82333;
}

.batch-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Progress Modal */
.print-progress-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 15px;
    padding: 30px;
    z-index: 10000;
    width: 90%;
    max-width: 500px;
    text-align: center;
    display: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.print-progress-modal.active {
    display: block;
}

.print-progress-modal h4 {
    margin: 0 0 20px 0;
    color: #0d0e51;
}

.progress-bar-container {
    background: #e0e0e0;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar-fill {
    background: linear-gradient(135deg, #0d0e51 0%, #1a1b7a 100%);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.progress-current {
    color: #666;
    margin-bottom: 20px;
}

.progress-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Main Page Button */
.btn-batch-print {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}

.btn-batch-print:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.btn-batch-print i {
    font-size: 1.2rem;
}

/* RTL Support */
[dir="rtl"] .batch-preview-table th,
[dir="rtl"] .batch-preview-table td {
    text-align: right;
}

[dir="rtl"] .batch-preview-table .row-number {
    text-align: center;
}

/* LTR Support (English) */
[dir="ltr"] .batch-preview-table th,
[dir="ltr"] .batch-preview-table td {
    text-align: left;
}

[dir="ltr"] .batch-preview-table .row-number {
    text-align: center;
}

[dir="ltr"] .batch-preview-table thead th {
    text-align: left;
}

[dir="ltr"] .batch-print-header {
    direction: ltr;
}

[dir="ltr"] .generator-form {
    direction: ltr;
}

[dir="ltr"] .batch-actions {
    direction: ltr;
}

/* Responsive */
@media (max-width: 768px) {
    .batch-print-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .batch-method-tabs {
        flex-direction: column;
    }
    
    .generator-row {
        flex-direction: column;
    }
    
    .batch-actions {
        flex-direction: column;
    }
    
    .batch-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Print Styles - Hide modal during print */
@media print {
    .batch-print-overlay,
    .batch-print-modal,
    .print-progress-modal,
    .btn-batch-print {
        display: none !important;
    }
}

/* Loading Spinner */
.batch-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.batch-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #0d0e51;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* File Upload Success */
.excel-upload-zone.success {
    border-color: #28a745;
    background: #d4edda;
}

.excel-upload-zone.success i {
    color: #28a745;
}

/* Editable Table Cells */
.batch-preview-table td[contenteditable="true"] {
    cursor: text;
    background: #fffef0;
}

.batch-preview-table td[contenteditable="true"]:focus {
    outline: 2px solid #0d0e51;
    background: #fff;
}

/* Status Badges */
.cheque-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.cheque-status.pending {
    background: #fff3cd;
    color: #856404;
}

.cheque-status.printing {
    background: #cce5ff;
    color: #004085;
}

.cheque-status.done {
    background: #d4edda;
    color: #155724;
}

.cheque-status.error {
    background: #f8d7da;
    color: #721c24;
}

/* Animation for current printing row */
.batch-preview-table tr.printing {
    background: linear-gradient(90deg, #cce5ff 0%, #e8f4ff 50%, #cce5ff 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Tooltip */
.batch-tooltip {
    position: relative;
    cursor: help;
}

.batch-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.batch-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Keyboard Shortcut Hints */
.keyboard-hint {
    display: inline-block;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-family: monospace;
    margin-left: 5px;
    color: #666;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .batch-print-modal {
        background-color: #1a1a2e;
        color: #eee;
    }
    
    .batch-print-header {
        background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
    }
    
    .generator-form,
    .batch-preview-header {
        background: #16213e;
    }
    
    .generator-field input,
    .generator-field select {
        background: #1a1a2e;
        color: #eee;
        border-color: #333;
    }
    
    .batch-preview-table th {
        background: #16213e;
        color: #eee;
    }
    
    .batch-preview-table td {
        border-color: #333;
    }
}


/* ========================================
   Additional Styles for Version 2.0
   ======================================== */

/* Save Cheques Modal */
.save-cheques-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.save-cheques-content {
    background: #fff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.save-cheques-content h4 {
    color: #0d0e51;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.save-cheques-content p {
    color: #666;
    margin-bottom: 10px;
}

.save-cheques-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

/* Date Section Styling */
.date-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
}

.date-section .generator-field {
    flex: 1;
}

.date-section small {
    display: block;
    margin-top: 5px;
}

/* Editable Cell Styling */
.editable-cell {
    cursor: text;
    min-width: 80px;
    transition: background-color 0.2s;
}

.editable-cell:hover {
    background-color: #f0f7ff;
}

.editable-cell:focus {
    background-color: #e8f4ff;
    outline: 2px solid #0d0e51;
    outline-offset: -2px;
}

/* Cheque Number Column */
.batch-preview-table th:nth-child(2),
.batch-preview-table td:nth-child(2) {
    width: 100px;
    text-align: center;
}

/* Last Cheque Number Display */
#lastChequeNumberDisplay {
    font-weight: bold;
    color: #0d0e51;
}

/* Generator Field Small Text */
.generator-field small {
    color: #888;
    font-size: 0.8rem;
    display: block;
    margin-top: 5px;
}

/* Silent Print Toggle */
.print-setting-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.print-setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Month/Year Selects */
#genStartMonth,
#genStartYear,
#genDayOfMonth {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    cursor: pointer;
}

#genStartMonth:focus,
#genStartYear:focus,
#genDayOfMonth:focus {
    border-color: #0d0e51;
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 14, 81, 0.1);
}

/* Day of Month Section Layout */
#dayOfMonthSection {
    display: none;
    flex-wrap: wrap;
}

#dayOfMonthSection .generator-field {
    min-width: 150px;
}

/* Interval Section Layout */
#intervalSection {
    display: none;
}

/* Print Frame (Hidden) */
#batchPrintFrame {
    position: absolute;
    width: 0;
    height: 0;
    border: none;
    visibility: hidden;
}

/* Row Printing Animation */
.batch-preview-table tr.printing {
    background: linear-gradient(90deg, #cce5ff 0%, #e8f4ff 50%, #cce5ff 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.batch-preview-table tr.printed {
    background-color: #d4edda;
}

.batch-preview-table tr.printed td {
    color: #155724;
}

/* Responsive Adjustments for Date Section */
@media (max-width: 768px) {
    #dayOfMonthSection,
    #intervalSection {
        flex-direction: column;
    }
    
    #dayOfMonthSection .generator-field,
    #intervalSection .generator-field {
        width: 100%;
    }
    
    .save-cheques-actions {
        flex-direction: column;
    }
    
    .save-cheques-actions button {
        width: 100%;
    }
}

/* Improved Table Scrolling */
.batch-preview-table {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.batch-preview-table table {
    width: 100%;
    border-collapse: collapse;
}

.batch-preview-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.batch-preview-table thead th {
    background: #0d0e51;
    color: #fff;
    padding: 12px 10px;
    font-weight: 600;
    text-align: right;
}

.batch-preview-table tbody td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.batch-preview-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Delete Icon */
.delete-row {
    color: #dc3545;
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.delete-row:hover {
    transform: scale(1.2);
}

/* Input Number Styling */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

/* Success State for Excel Upload */
.excel-upload-zone.success {
    border-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.excel-upload-zone.success i {
    color: #28a745;
}

.excel-upload-zone.success p {
    color: #155724;
}
