/* PDF Utility CSS
   Colors:
   - Navy (Primary): #00275D
   - Amber (Accent): #E29E21
   - Dark Slate: #1A1A1A
   - Light Gray / BG: #F8F9FA
*/

/* Container & Layout */
.pdf-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
}

.pdf-header-title {
    color: #00275D;
    font-weight: 700;
    margin-bottom: 30px;
    border-bottom: 3px solid #E29E21;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(0, 39, 93, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Upload Zone */
.pdf-upload-zone {
    border: 2px dashed rgba(0, 39, 93, 0.25);
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    background: #fdfdfd;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.pdf-upload-zone:hover, .pdf-upload-zone.dragover {
    border-color: #E29E21;
    background: rgba(226, 158, 33, 0.04);
}

.pdf-upload-icon {
    font-size: 3.5rem;
    color: #00275D;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

.pdf-upload-zone:hover .pdf-upload-icon {
    transform: translateY(-5px);
}

.pdf-upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.pdf-upload-subtext {
    font-size: 0.9rem;
    color: #666;
}

.pdf-upload-limit {
    font-size: 0.8rem;
    color: #dc3545;
    font-weight: 600;
    margin-top: 8px;
    display: inline-block;
    background: rgba(220, 53, 69, 0.08);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Progress & Loading States */
.pdf-progress-wrapper {
    margin: 20px 0;
    display: none;
}

.pdf-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    color: #00275D;
    margin-bottom: 6px;
}

.pdf-progress-bar {
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}

.pdf-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00275D, #E29E21);
    border-radius: 5px;
    transition: width 0.1s linear;
}

/* Active File Info */
.pdf-file-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 39, 93, 0.04);
    border-left: 4px solid #00275D;
    padding: 15px 20px;
    border-radius: 4px;
    margin-top: 20px;
}

.pdf-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pdf-file-icon {
    font-size: 2rem;
    color: #dc3545;
}

.pdf-file-name {
    font-weight: 600;
    color: #00275D;
    word-break: break-all;
}

.pdf-file-meta {
    font-size: 0.85rem;
    color: #666;
    margin-top: 2px;
}

.pdf-btn-remove {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px;
}

.pdf-btn-remove:hover {
    color: #bd2130;
}

/* Configurations section */
.pdf-config-section {
    display: none;
}

.pdf-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.pdf-split-type {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pdf-input-number {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
}

.pdf-input-number:focus {
    border-color: #00275D;
    outline: none;
}

/* Ranges Grid */
.pdf-ranges-container {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
    margin-bottom: 25px;
}

.pdf-range-row {
    display: grid;
    grid-template-columns: 80px 1.5fr 1fr 1fr 40px;
    gap: 15px;
    align-items: center;
    background: #fdfdfd;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.pdf-range-row:focus-within {
    border-color: #00275D;
}

.pdf-range-row.invalid-range {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.02);
}

.pdf-range-num {
    font-weight: bold;
    color: #666;
}

.pdf-range-row label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

.pdf-range-row input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.pdf-range-row input:focus {
    border-color: #00275D;
    outline: none;
}

.pdf-range-delete {
    background: none;
    border: none;
    color: #999;
    font-size: 1.15rem;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 38px;
    width: 38px;
    border-radius: 4px;
}

.pdf-range-delete:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.pdf-btn-add-range {
    background: none;
    border: 1px dashed #00275D;
    color: #00275D;
    border-radius: 6px;
    padding: 10px;
    width: 100%;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pdf-btn-add-range:hover {
    background: rgba(0, 39, 93, 0.05);
    border-style: solid;
}

.pdf-validation-msg {
    color: #dc3545;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 10px;
    display: none;
    align-items: center;
    gap: 6px;
}

/* Primary Button Action */
.pdf-btn-primary {
    background: #00275D;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 14px 28px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.pdf-btn-primary:hover {
    background: #0b3775;
    box-shadow: 0 4px 15px rgba(0, 39, 93, 0.2);
}

.pdf-btn-primary:disabled {
    background: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Results section */
.pdf-results-section {
    display: none;
}

.pdf-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.pdf-results-list {
    margin-bottom: 25px;
}

.pdf-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    background: #fdfdfd;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 12px;
    gap: 15px;
}

.pdf-result-details {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pdf-result-meta {
    font-size: 0.85rem;
    color: #666;
}

.pdf-result-actions {
    display: flex;
    gap: 10px;
}

.pdf-btn-secondary {
    background: white;
    border: 1px solid #00275D;
    color: #00275D;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pdf-btn-secondary:hover {
    background: rgba(0, 39, 93, 0.05);
}

.pdf-btn-success {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pdf-btn-success:hover {
    background: #218838;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.pdf-btn-zip {
    background: #E29E21;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pdf-btn-zip:hover {
    background: #cb8916;
    box-shadow: 0 4px 12px rgba(226, 158, 33, 0.2);
}

/* Modal styling */
.pdf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1060;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.pdf-modal-dialog {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.pdf-modal-header {
    padding: 15px 20px;
    background: #00275D;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdf-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.pdf-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.pdf-modal-close:hover {
    opacity: 1;
}

.pdf-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    background: #525659; /* Standard PDF dark background */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 300px;
    position: relative;
}

.pdf-canvas-container {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    background: white;
    margin: auto;
    position: relative;
    max-width: 100%;
}

#pdfPreviewCanvas {
    display: block;
    max-width: 100%;
    height: auto !important;
}

.pdf-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    flex-wrap: wrap;
    gap: 15px;
}

.pdf-nav-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pdf-page-num {
    font-weight: 600;
    color: #333;
}

.pdf-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid #ffffff;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

.pdf-spinner-dark {
    border-color: rgba(0, 39, 93, 0.1);
    border-top-color: #00275D;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Scrollbar for ranges */
.pdf-ranges-container::-webkit-scrollbar {
    width: 6px;
}
.pdf-ranges-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.pdf-ranges-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
.pdf-ranges-container::-webkit-scrollbar-thumb:hover {
    background: #00275D;
}

/* Responsive adjust */
@media (max-width: 768px) {
    .pdf-range-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .pdf-range-num {
        grid-column: span 2;
        border-bottom: 1px solid #eee;
        padding-bottom: 5px;
    }
    .pdf-range-delete {
        grid-column: span 2;
        width: 100%;
        margin-top: 5px;
    }
}
