/**
 * Plugin Certificados – Unified Stylesheet
 *
 * All UI styles for the certificate generation plugin:
 * wizard, template editor, dashboard, history, images sidebar, etc.
 */

/* Global Font Family Override for Plugin */
#certificados-form,
#certificados-form h1,
#certificados-form h2,
#certificados-form h3,
#certificados-form h4,
#certificados-form h5,
#certificados-form h6,
.step-progress,
.step-content,
.loading-overlay,
.result-container,
.validation-success,
.validation-error,
.main-results,
.collapsible-section,
.certificados-dashboard-v2,
.certificados-logs-content,
.certificados-settings-content,
.certificados-cleanup-content,
.certificados-history-content,
.certificados-templates-content,
.certificados-config-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* Keep natural container width from theme/layout */
.step-progress,
#certificados-form {
    width: 100%;
    max-width: 100%;
}

/* Progress Indicator */
.step-progress {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 20px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.step.active {
    opacity: 1;
}

.step.completed {
    opacity: 1;
    color: #28a745;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 8px;
    transition: background-color 0.3s ease;
}

.step.active .step-number {
    background: #007cba;
}

.step.completed .step-number {
    background: #28a745;
}

.step-label {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

/* Step Content */
.step-content {
    display: none;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.step-content.active {
    display: block;
    animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-header {
    margin-bottom: 25px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 15px;
}

.step-header h3 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    font-family: inherit;
}

.step-description {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
}

/* File Upload Area */
.file-upload-area {
    margin-bottom: 25px;
}

/* Step 2: reduce vertical scroll by placing requirements and upload side-by-side */
#step-2 {
    display: grid;
    grid-template-columns: minmax(520px, 1.4fr) minmax(320px, 1fr);
    gap: 16px 20px;
}

#step-2 .step-header,
#step-2 .step-actions,
#step-2 #validation-result {
    grid-column: 1 / -1;
}

#step-2 .excel-requirements,
#step-2 .file-upload-area {
    margin-bottom: 0;
}

#step-2 .file-upload-area {
    align-self: start;
}

.upload-zone {
    border: 2px dashed #007cba;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-zone:hover {
    border-color: #0056b3;
    background: #e3f2fd;
}

.upload-zone.dragover {
    border-color: #28a745;
    background: #d4edda;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 8px 0;
    color: #2c3e50;
}

.upload-hint {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
}

#excel-file {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #e3f2fd;
    border: 1px solid #007cba;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name {
    font-weight: 500;
    color: #2c3e50;
}

.file-size {
    font-size: 12px;
    color: #6c757d;
}

.remove-file {
    background: #007cba;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.remove-file:hover {
    background: #0056b3;
}

/* Configuration Section */
.config-section {
    margin-bottom: 25px;
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 16px 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
}

.form-group label strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

.field-help {
    font-size: 12px;
    color: #6c757d;
    font-weight: normal;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 123, 186, 0.25);
}

/* Excel Requirements Section */
.excel-requirements {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 25px;
}

.excel-requirements h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
}

.excel-requirements p {
    margin: 0 0 15px 0;
    color: #495057;
}

.excel-sample-table {
    overflow-x: auto;
    margin-bottom: 15px;
}

.sample-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sample-table th,
.sample-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
}

.sample-table th {
    background: #007cba;
    color: white;
    font-weight: 600;
    font-size: 11px;
}

.sample-table td {
    color: #495057;
}

.sample-table tr:last-child td {
    border-bottom: none;
}

.format-notes {
    margin-top: 15px;
}

.format-notes h5 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
}

.format-notes ul {
    margin: 0;
    padding-left: 20px;
}

.format-notes li {
    margin-bottom: 5px;
    color: #495057;
    font-size: 13px;
    line-height: 1.4;
}

.format-notes code {
    background: #e9ecef;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 11px;
    color: #9c1d64;
}

/* Validation Success Info */
.validation-success-info {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

.success-header h4 {
    margin: 0 0 15px 0;
    color: #155724;
    font-size: 16px;
}

.file-stats {
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px 0;
}

.stat-label {
    font-weight: 500;
    color: #155724;
}

.stat-value {
    color: #155724;
    font-weight: 600;
}

/* File Summary Section */
.file-summary {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 25px;
}

.file-summary h4 {
    margin: 0 0 15px 0;
    color: #1565c0;
    font-size: 16px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    align-items: start;
}

.summary-grid .summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.summary-grid .summary-label {
    font-weight: 500;
    color: #1565c0;
    font-size: 12px;
}

.summary-grid .summary-value {
    color: #0d47a1;
    font-weight: 600;
    font-size: 14px;
}

/* PDF Filename Preview */
.filename-preview {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #007cba;
}

.filename-preview strong {
    font-size: 12px;
    font-weight: 500;
    color: #495057;
}

.filename-preview code {
    background: transparent;
    color: #007cba;
    font-weight: 500;
    font-size: 12px;
}

/* Summary Section */
.summary-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 25px;
}

.summary-section h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px 0;
}

.summary-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.summary-label {
    font-weight: 600;
    color: #495057;
}

.summary-value {
    color: #2c3e50;
    text-align: right;
    max-width: 60%;
    word-wrap: break-word;
}

/* Action Buttons */
.step-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.btn-primary, .btn-secondary, .btn-success, #validate-btn, #generate-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #007cba;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success, #generate-btn {
    background: #1e7e34;
    color: white;
}

.btn-success:hover:not(:disabled), #generate-btn:hover:not(:disabled) {
    background: #218838;
}

#validate-btn {
    background: #007cba;
    color: white;
}

#validate-btn:hover:not(:disabled) {
    background: #0056b3;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

.btn-loading {
    display: none !important;
}

button.loading .btn-text {
    display: none;
}

button.loading .btn-loading {
    display: inline-flex !important;
}

/* Result Containers */
.result-container, .results-summary {
    margin-top: 20px;
    border-radius: 4px;
    display: none;
}

.result-container.show, .results-summary.show {
    display: block;
}

.results-summary {
    background: transparent;
    border: none;
    display: block;
    margin-top: 0;
}

.results-summary h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    padding-bottom: 10px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.result-label {
    font-weight: 500;
    color: #495057;
}

.result-value {
    color: #2c3e50;
    text-align: right;
    max-width: 60%;
    word-wrap: break-word;
}

.result-value.success {
    color: #28a745;
    font-weight: 500;
}

.result-value.error {
    color: #dc3545;
    font-weight: 500;
}

.result-container .ok {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 10px;
    border-radius: 4px;
    margin: 0 0 10px 0;
}

.result-container .error {
    color: #721c24;
}

.result-container ul {
    margin: 10px 0 0 20px;
    color: #721c24;
}

.result-container li {
    margin-bottom: 5px;
}

/* Loading Overlay - Maximum compatibility and positioning */
.loading-overlay {
    position: fixed !important;
    top: 0px !important;
    left: 0px !important;
    right: 0px !important;
    bottom: 0px !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.8) !important;
    z-index: 2147483647 !important; /* Maximum z-index value */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0px !important;
    padding: 0px !important;
    border: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transform: translate3d(0, 0, 0) !important; /* Force GPU acceleration */
    pointer-events: auto !important;
    /* Ensure it's always on top and unaffected by containers */
    contain: layout style paint !important;
    isolation: isolate !important;
    /* Override any potential theme or plugin conflicts */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    text-align: left !important;
    direction: ltr !important;
    /* Create a new stacking context above everything */
    backdrop-filter: blur(2px) !important;
    /* Force to be at the root level */
    max-width: none !important;
    max-height: none !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
}

/* Force the overlay to be absolutely positioned from the viewport */
body.loading-active,
body.modal-open {
    overflow: hidden !important;
}

/* Ensure overlay is hidden when display:none */
.loading-overlay[style*="display: none"],
.loading-overlay[style*="display:none"] {
    display: none !important;
    visibility: hidden !important;
}

/* Ensure overlay is visible when shown */
.loading-overlay:not([style*="display: none"]):not([style*="display:none"]) {
    display: flex !important;
    visibility: visible !important;
}

.loading-content {
    background: white !important;
    border-radius: 12px !important;
    padding: 40px !important;
    text-align: center !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    max-width: 400px !important;
    width: 90% !important;
    max-height: 90vh !important;
    position: relative !important;
    z-index: 1000000 !important;
    overflow-y: auto !important;
    margin: 0 !important;
    /* Ensure content is properly styled */
    line-height: 1.5 !important;
    color: #2c3e50 !important;
}

.loading-spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border: 4px solid #e9ecef;
    border-left: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-title {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    font-family: inherit;
}

.loading-message {
    margin: 0 0 25px 0;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
}

.loading-progress {
    margin-top: 20px;
}

.loading-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.loading-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #007cba, #0056b3, #007cba);
    background-size: 200% 100%;
    animation: loadingProgress 2s ease-in-out infinite;
}

/* Determinate mode: real percentage-based progress bar */
.loading-bar-fill.determinate {
    width: 0%;
    animation: none;
    background: linear-gradient(90deg, #007cba, #0056b3);
    background-size: 100% 100%;
    transition: width 0.4s ease;
}

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

.loading-text {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .step-progress {
        padding: 15px 5px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .step {
        margin: 0 5px;
        flex: 1;
        min-width: 80px;
    }
    
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .step-label {
        font-size: 9px;
    }
    
    .step-content {
        padding: 20px 15px;
    }
    
    .step-actions {
        flex-direction: column;
    }
    
    .step-actions button {
        width: 100%;
        justify-content: center;
    }
    
    .summary-item, .result-item {
        flex-direction: column;
        gap: 5px;
    }
    
    .summary-value, .result-value {
        text-align: left;
        max-width: 100%;
    }
    
    .loading-content {
        padding: 25px 15px !important;
        margin: 0 10px !important;
        max-width: calc(100vw - 20px) !important;
        width: calc(100% - 20px) !important;
        border-radius: 8px !important;
    }
    
    .loading-title {
        font-size: 16px !important;
        margin-bottom: 8px !important;
    }
    
    .loading-message {
        font-size: 13px !important;
        margin-bottom: 20px !important;
    }
    
    .loading-spinner {
        width: 48px !important;
        height: 48px !important;
        margin-bottom: 15px !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .step-progress {
        background: #2c3e50;
        border-color: #495057;
    }
    
    .step-content {
        background: #343a40;
        border-color: #495057;
        color: #fff;
    }
    
    .step-header {
        border-color: #495057;
    }
    
    .step-header h3 {
        color: #fff;
    }
    
    .upload-zone {
        background: #495057;
        border-color: #007cba;
        color: #fff;
    }
    
    .summary-section {
        background: #495057;
        border-color: #6c757d;
    }
    
    .form-group input {
        background: #495057;
        border-color: #6c757d;
        color: #fff;
    }
}

/* Collapsible Sections for Step 4 */
.collapsible-sections {
    margin: 20px 0;
}

.collapsible-section {
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.collapsible-header {
    width: 100%;
    background: #f8f9fa;
    border: none;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
}

.collapsible-header:hover {
    background: #e9ecef;
}

.collapsible-header.active {
    background: #007cba;
    color: white;
}

.collapsible-header.active:hover {
    background: #0056b3;
}

.collapsible-title {
    flex: 1;
    margin: 0 15px;
    font-weight: 600;
    font-family: inherit;
}

.collapsible-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007cba;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.collapsible-header.active .collapsible-icon {
    background: white;
    color: #007cba;
}

.collapsible-action {
    font-size: 14px;
    color: #6c757d;
    font-weight: 400;
}

.collapsible-header.active .collapsible-action {
    color: #fff;
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-content.expanded {
    max-height: none;
    overflow-y: auto;
}

.collapsible-body {
    padding: 14px 16px;
    border-top: 1px solid #e9ecef;
    background: #fff;
}

/* Collapsible content styling */
.collapsible-body .detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.collapsible-body .detail-item:last-child {
    border-bottom: none;
}

.collapsible-body .detail-label {
    font-weight: 600;
    color: #495057;
}

.collapsible-body .detail-value {
    color: #2c3e50;
}

/* Delivery note: full-width block instead of cramped flex row */
.detail-item.delivery-note {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px dashed #dee2e6;
}

.detail-item.delivery-note .detail-value {
    font-size: 0.9em;
    line-height: 1.6;
    color: #5a6268;
}

/* Error summary styling - similar to collapsible sections */
.error-summary .detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.error-summary .detail-item:last-child {
    border-bottom: none;
}

.error-summary .detail-label {
    font-weight: 600;
    color: #495057;
}

.error-summary .detail-value {
    font-weight: 500;
}

.error-summary .detail-value.success {
    color: #28a745;
}

.error-summary .detail-value.error {
    color: #dc3545;
}

.collapsible-body .config-item {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007cba;
}

.collapsible-body .config-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.collapsible-body .config-value {
    color: #6c757d;
    font-family: monospace;
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Main Results Styling */
.main-results {
    text-align: center;
    padding: 12px 8px 6px;
    margin-bottom: 12px;
    border-radius: 0;
    background: transparent;
    color: #2c3e50;
}

.main-results.error {
    color: white;
}

.main-results h4 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    font-family: inherit;
}

/* Enhanced Error Display Styles */
.error-item {
    margin: 12px 0;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #dc3545;
    background: #f8d7da;
}

/* Warning Display Styles (orange/yellow - non-blocking) */
.warning-item {
    margin: 12px 0;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #e0a800;
    background: #fff3cd;
}

.warning-header {
    font-weight: 600;
    margin-bottom: 6px;
    color: #2c3e50;
    display: block;
    line-height: 1.4;
}

.warning-header-main {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.warning-type {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #fff3cd;
    border: 1px solid #e0a800;
    color: #856404;
    display: inline-block;
    white-space: nowrap;
    margin-top: 2px;
}

.warning-item .warning-msg {
    color: #856404;
    margin: 6px 0;
    line-height: 1.4;
}

.warning-list {
    max-height: none;
    overflow: visible;
    border: none;
    padding: 0;
    background: transparent;
}

/* Generation Error Styling - identical to validation errors */
.generation-error,
.validation-error {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 14px;
    margin-top: 12px;
}

.generation-error h4,
.validation-error h4 {
    margin: 0 0 15px 0;
    color: #721c24;  /* Keep red text for error indication */
    font-size: 16px;
    font-weight: 600;
    font-family: inherit !important;
}

.generation-error .error-summary,
.validation-error .error-summary {
    margin-bottom: 20px;
}

/* Remove any scrollbar from error lists */
.generation-error .error-list,
.validation-error .error-list {
    max-height: none;
    overflow: visible;
    border: none;
    padding: 0;
    background: transparent;
}

.error-header {
    font-weight: 600;
    margin-bottom: 6px;
    color: #2c3e50;
    display: block;
    line-height: 1.4;
}

.error-header-main {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.error-type,
.error-context {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #ffffff;
    border: 1px solid #ced4da;
    color: #212529;
    display: inline-block;
    white-space: nowrap;
    margin-top: 2px;
}

.error-message {
    color: #721c24;
    margin: 6px 0;
    line-height: 1.4;
}

.raw-data {
    font-size: 11px;
    font-family: monospace;
    color: #6c757d;
    background: #ffffff;
    padding: 6px 8px;
    border-radius: 3px;
    margin-top: 6px;
    border: 1px solid #e9ecef;
    word-break: break-all;
}

.error-details h5 {
    color: #495057;
    margin: 15px 0 10px 0;
    font-size: 14px;
}

.error-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px;
    background: #ffffff;
}


/* Access Control Styling */
.certificados-access-denied {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 20px 0;
}

.certificados-access-denied h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 24px;
}

.certificados-access-denied p {
    color: #6c757d;
    margin-bottom: 15px;
    line-height: 1.5;
}

.certificados-access-denied .button {
    background: #007cba;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
    transition: background-color 0.3s;
}

.certificados-access-denied .button:hover {
    background: #005a87;
    color: white;
}

/* Single Template Section Styling */
.single-template-section {
    margin: 20px 0;
}

.template-card {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 10px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 20px;
}

.template-card:hover {
    border-color: #007cba;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.template-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-thumbnail img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover;
    display: block;
}

.thumbnail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.placeholder-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.placeholder-text {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 500;
}

.template-info {
    flex-grow: 1;
}

.template-info h4 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 16px;
    font-weight: 600;
}

.template-type {
    background: #e3f2fd;
    color: #0d47a1;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    display: inline-block;
}

.template-actions {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.template-actions button {
    border: none !important;
    border-radius: 4px !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
}

.template-actions .btn-secondary {
    background: #6c757d !important;
    color: white !important;
}

.template-actions .btn-secondary:hover {
    background: #5a6268 !important;
}

/* Prevent background scroll when template modal is open */
body.template-modal-open {
    overflow: hidden !important;
}

/* Template Editor Modal */
.template-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Confirmation Modal Styles */
.confirmation-modal {
    max-width: 600px;
    max-height: 400px;
}

.warning-message {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
}

.warning-icon {
    font-size: 24px;
    color: #856404;
    flex-shrink: 0;
}

.warning-text {
    flex: 1;
}

.warning-text p {
    margin: 0 0 10px 0;
    color: #856404;
    line-height: 1.5;
}

.warning-text p:last-child {
    margin-bottom: 0;
    font-weight: 600;
}

.confirmation-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Split Screen Modal Styles */
.split-screen-modal .modal-content {
    width: 95%;
    max-width: 1400px;
    max-height: 95vh;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
}

.split-screen .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.editor-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.split-screen-body {
    display: flex;
    flex: 1;
    min-height: 0;
    padding: 0;
}

.editor-panel,
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #dee2e6;
}

.preview-panel {
    border-right: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    font-weight: 600;
}

.panel-header h4 {
    margin: 0;
    font-size: 14px;
    color: #495057;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.btn-small {
    background: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-small:hover {
    background: #5a6268;
}

.editor-container,
.preview-container {
    flex: 1;
    display: flex;
}

#template-editor {
    width: 100%;
    height: 100%;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.4;
    border: none;
    padding: 15px;
    resize: none;
    outline: none;
    background: #fafafa;
    border-right: 1px solid #dee2e6;
}

#template-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.modal-header {
    background: #f8f9fa;
    padding: 20px 30px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
    font-size: 18px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #495057;
    background: #e9ecef;
    border-radius: 50%;
}

.modal-body {
    padding: 30px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.editor-status {
    color: #6c757d;
    font-size: 14px;
    font-style: italic;
    margin-left: 15px;
}

.validation-results {
    margin: 0;
    padding: 15px 25px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    flex-shrink: 0;
}

.validation-success {
    color: #155724;
    background: #d4edda;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
}

.validation-error {
    color: #721c24;
    background: #f8d7da;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
}

.validation-warning {
    color: #856404;
    background: #fff3cd;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ffc107;
    line-height: 1.6;
}

.validation-warning div {
    margin-bottom: 4px;
}

.validation-warning div:last-child {
    margin-bottom: 0;
}

/* Amount Format Configuration */
.format-preview-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}

.preview-examples {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
}

.example-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.example-label {
    color: #6c757d;
    font-size: 14px;
}

.example-value {
    font-family: monospace;
    font-size: 15px;
    font-weight: bold;
    color: #1e7e34;
    background: white;
    padding: 3px 7px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.format-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
}

#amount-format-details .format-options .form-group {
    margin-bottom: 0;
}

#amount-format-details .format-options .form-group:nth-child(1),
#amount-format-details .format-options .form-group:nth-child(2) {
    grid-column: 1;
}

#amount-format-details .format-options .form-group:nth-child(3) {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
}

.checkbox-group {
    margin-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding-left: 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.checkbox-label .checkmark {
    display: none; /* Using native checkbox for simplicity */
}

.checkbox-label strong {
    display: block;
    color: #495057;
    margin-bottom: 0;
    line-height: 1.25;
}

.checkbox-label .field-help {
    display: block;
    font-size: 12px;
    line-height: 1.3;
    margin-top: 2px;
    color: #6c757d;
    font-weight: normal;
}

/* Operation Mode Selection Styles (Step 2) */
.operation-mode-section {
    padding: 20px 0;
}

.mode-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin: 20px 0;
}

.mode-option {
    flex: 1;
}

.radio-card {
    display: block;
    cursor: pointer;
    height: 100%;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.card-content {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 18px;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.radio-card:hover .card-content {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
    transform: translateY(-2px);
}

.radio-card input[type="radio"]:checked ~ .card-content {
    border-color: #85c1e9;
    background: #eef7ff;
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.2);
}

.card-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 10px;
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 8px;
}

.card-description {
    font-size: 14px;
    color: #5a6c7d;
    text-align: center;
    margin-bottom: 14px;
    line-height: 1.6;
    flex: 1;
}

.card-requirements {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-top: auto;
}

.requirement-label {
    font-weight: 600;
    color: #2c3e50;
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
}

.card-requirements ul {
    margin: 8px 0;
    padding-left: 20px;
    list-style: disc;
}

.card-requirements li {
    color: #5a6c7d;
    font-size: 13px;
    margin: 4px 0;
}

.card-requirements li strong {
    color: #2c3e50;
    font-weight: 600;
}

.requirement-note {
    margin-top: 12px;
    padding: 10px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    font-size: 12px;
    color: #856404;
}

.requirement-note strong {
    font-weight: 600;
}

.radio-card input[type="radio"]:checked ~ .card-content .requirement-note {
    background: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

#email-column-header {
    font-weight: 700;
}

/* Step 4: keep fields compact (no forced full-width for last field) */
#step-3 .config-section,
#step-4 .config-section {
    grid-template-columns: minmax(160px, 280px) minmax(320px, 560px);
    gap: 22px 26px;
    justify-content: start;
    align-items: start;
}

#step-3 .config-section .form-group,
#step-4 .config-section .form-group {
    margin-bottom: 0;
}

#step-3 .config-section #certificado-year,
#step-4 .config-section #certificado-year {
    max-width: 220px;
}

#step-3 .config-section .form-group:last-child,
#step-3 .config-section .filename-preview,
#step-4 .config-section .form-group:last-child,
#step-4 .config-section .filename-preview {
    grid-column: auto;
}

#step-3 .config-section .form-group:last-child,
#step-4 .config-section .form-group:last-child {
    grid-column: 1 / -1;
    max-width: 560px;
}

#step-3 .config-section .filename-preview,
#step-4 .config-section .filename-preview {
    max-width: 100%;
}

#amount-format-details .collapsible-body {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(280px, 1fr);
    gap: 20px;
    align-items: start;
}

/* Responsive adjustments for operation mode */
@media (max-width: 768px) {
    .mode-options {
        grid-template-columns: 1fr;
    }
    
    .card-content {
        padding: 20px;
    }
    
    .card-icon {
        font-size: 40px;
    }
    
    .card-title {
        font-size: 18px;
    }

    .preview-examples {
        grid-template-columns: 1fr;
    }

    .format-options {
        grid-template-columns: 1fr;
    }

    #amount-format-details .format-options .form-group:nth-child(1),
    #amount-format-details .format-options .form-group:nth-child(2),
    #amount-format-details .format-options .form-group:nth-child(3) {
        grid-column: 1;
        grid-row: auto;
    }

    .config-section {
        grid-template-columns: 1fr;
    }

    #step-3 .config-section,
    #step-4 .config-section {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    #step-3 .config-section .form-group:last-child,
    #step-4 .config-section .form-group:last-child {
        grid-column: auto;
        max-width: 100%;
    }

    #step-3 .config-section #certificado-year,
    #step-4 .config-section #certificado-year {
        max-width: 100%;
    }

    #amount-format-details .collapsible-body {
        grid-template-columns: 1fr;
    }

    #step-2 {
        grid-template-columns: 1fr;
    }
}

/* PDF Download List Styles */
.pdf-download-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
}

.pdf-download-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.pdf-download-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

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

.pdf-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.pdf-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pdf-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.pdf-filename {
    font-size: 12px;
    color: #6c757d;
}

.pdf-filename-text {
    font-family: monospace;
}

.year-badge {
    display: inline-block;
    background: #e8f4fd;
    color: #0b57a0;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
    border: 1px solid #b8d9f2;
    vertical-align: middle;
    letter-spacing: 0.3px;
}

.pdf-date {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #1e7e34;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-download.btn-download-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.pdf-summary-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pdf-download-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overscroll-behavior: contain;
}

.pdf-download-modal-content {
    width: min(980px, 96vw);
    max-height: 90vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pdf-download-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.pdf-download-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.pdf-download-modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    background: #ffffff;
    flex-wrap: wrap;
}

.pdf-bulk-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pdf-select-all,
.pdf-select-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    line-height: 1.4;
}

.pdf-select-all input[type="checkbox"],
.pdf-select-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.pdf-download-modal-body {
    padding: 12px 16px;
    overflow-y: auto;
    max-height: calc(90vh - 180px);
    overscroll-behavior: contain;
}

#final-results .step-actions {
    border-top: none;
    padding-top: 8px;
    margin-top: 10px;
}

/* Step 5 scroll containment — prevent background page from scrolling */
#step-5 {
    max-height: 80vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Inline certificate list (used in history page) */
.certificate-list-inline {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.certificate-list-inline .pdf-download-modal-body {
    max-height: 70vh;
    overflow: auto;
}

/* Search box in certificate list */
.cert-search-box {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.cert-search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cert-search-box input:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.15);
}

.cert-search-no-results {
    padding: 20px 16px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.history-list-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.history-list-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.btn-download:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
    color: white;
    text-decoration: none;
}

.btn-download:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .pdf-download-item {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .pdf-info {
        width: 100%;
    }
    
    .btn-download {
        width: 100%;
        justify-content: center;
    }

    .pdf-download-modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .pdf-bulk-actions {
        width: 100%;
    }

    .pdf-bulk-actions .btn-primary,
    .pdf-bulk-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 1200px) {
    #step-2 {
        grid-template-columns: 1fr;
    }

    .config-section {
        grid-template-columns: repeat(2, minmax(260px, 1fr));
    }
}

/* ============================================
   DASHBOARD STYLES (Sidebar Navigation)
   ============================================ */

.certificados-dashboard-v2 {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.main-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #1e293b;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
}

.sidebar-nav {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar-nav nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #475569;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-item:hover {
    background: #f1f5f9;
}

.sidebar-item.active {
    background: #eff6ff;
    color: #2563eb;
}

.item-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.item-label {
    font-size: 14px;
}

.main-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (max-width: 992px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar-nav {
        position: relative;
        top: 0;
    }
    
    .sidebar-nav nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ============================================
   LOGS TABLE STYLES
   ============================================ */

.certificados-logs-table {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.certificados-logs-table thead th {
    background: #f8f9fa;
    font-weight: 600;
    padding: 12px;
    border-bottom: 2px solid #e0e0e0;
}

.certificados-logs-table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
}

.certificados-logs-table tbody tr:hover {
    background: #f8f9fa;
}

.log-row-selected {
    background: #e3f2fd !important;
}

.log-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #2563eb;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.action-link {
    color: #007cba !important;
    text-decoration: none !important;
    font-weight: 500;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    cursor: pointer;
    transition: color 0.2s ease;
}

.action-link:hover {
    color: #005a87 !important;
    text-decoration: underline !important;
}

.action-link:focus {
    box-shadow: none !important;
    outline: 1px dotted #007cba !important;
    outline-offset: 2px;
}

.button-small {
    padding: 4px 12px !important;
    height: auto !important;
    line-height: 1.4 !important;
    font-size: 13px !important;
}

.log-content-header {
    margin-top: 24px;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.log-content-textarea {
    width: 100%;
    min-height: 420px;
    font-family: monospace;
}

.log-error-notice {
    margin-top: 16px;
}

/* ============================================
   FORM UTILITIES
   ============================================ */

.filter-form {
    margin: 12px 0 20px;
}

.cleanup-confirmation-input {
    display: block;
    margin-top: 6px;
    width: 280px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.cleanup-confirmation-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

/* ============================================
   STANDARDIZED FORM CONTROLS
   ============================================ */

.certificados-settings-content h2,
.certificados-cleanup-content h2,
.certificados-logs-content h2,
.certificados-history-content h2,
.certificados-config-content h2,
.certificados-templates-content h2 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
}

.certificados-settings-content input[type="text"],
.certificados-settings-content input[type="email"],
.certificados-settings-content input[type="number"],
.certificados-settings-content select,
.certificados-cleanup-content input[type="text"],
.certificados-cleanup-content select,
.certificados-logs-content select,
.certificados-history-content select,
.certificados-config-content select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    max-width: 400px;
}

.certificados-settings-content input:focus,
.certificados-settings-content select:focus,
.certificados-cleanup-content input:focus,
.certificados-cleanup-content select:focus,
.certificados-logs-content select:focus,
.certificados-history-content select:focus,
.certificados-config-content select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.certificados-settings-content .button,
.certificados-cleanup-content .button,
.certificados-logs-content .button,
.certificados-history-content .button,
.certificados-config-content .button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.certificados-settings-content .button-primary,
.certificados-cleanup-content .button-primary,
.certificados-logs-content .button-primary,
.certificados-history-content .button-primary,
.certificados-config-content .button-primary {
    background: #007cba;
    color: white;
}

.certificados-settings-content .button-primary:hover,
.certificados-cleanup-content .button-primary:hover,
.certificados-logs-content .button-primary:hover,
.certificados-history-content .button-primary:hover,
.certificados-config-content .button-primary:hover {
    background: #0056b3;
}

.certificados-settings-content .button-secondary,
.certificados-cleanup-content .button-secondary,
.certificados-logs-content .button-secondary,
.certificados-history-content .button-secondary,
.certificados-config-content .button-secondary {
    background: #f0f0f1;
    color: #2c3338;
}

.certificados-settings-content .button-secondary:hover,
.certificados-cleanup-content .button-secondary:hover,
.certificados-logs-content .button-secondary:hover,
.certificados-history-content .button-secondary:hover,
.certificados-config-content .button-secondary:hover {
    background: #dcdcde;
}

.certificados-settings-content label,
.certificados-cleanup-content label,
.certificados-logs-content label,
.certificados-history-content label,
.certificados-config-content label {
    font-weight: 500;
    color: #1e293b;
    font-size: 14px;
}

.certificados-settings-content p,
.certificados-cleanup-content p,
.certificados-logs-content p,
.certificados-history-content p,
.certificados-config-content p {
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
}

/* Settings subsection when embedded inside another tab (e.g. Plantillas) */
.certificados-settings-subsection {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
}

/* Consecutive template sections: separator */
.certificados-templates-content + .certificados-templates-content {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
}

/* ============================================
   ENVIRONMENT CONFIG PAGE (admin-config.php)
   ============================================ */

.config-danger-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-left: 4px solid #e53e3e;
    border-radius: 6px;
    color: #742a2a;
    font-size: 14px;
    line-height: 1.5;
}

.danger-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.danger-text strong {
    color: #c53030;
}

.config-groups-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.config-group--templates {
    grid-row: span 2;
}

@media (max-width: 900px) {
    .config-groups-grid {
        grid-template-columns: 1fr;
    }
}

.config-group {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.config-group h3 {
    margin: 0;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    background: #f8fafc;
    border-bottom: 1px solid #ddd;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.config-fields {
    padding: 16px 18px;
}

.config-field {
    margin-bottom: 16px;
}

.config-field:last-child {
    margin-bottom: 0;
}

.config-field label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 4px;
}

.config-field input[type="text"],
.config-field input[type="email"],
.config-field input[type="number"],
.config-field input[type="password"],
.config-field select {
    width: 100%;
    max-width: 420px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.config-field input:focus,
.config-field select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.config-hint {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 3px;
    line-height: 1.4;
}

.password-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 460px;
}

.password-wrapper input {
    flex: 1;
}

.btn-toggle-visibility {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-toggle-visibility:hover {
    background: #f1f5f9;
}

.config-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #ddd;
}

/* Mailjet validation results */
.mailjet-validation-result {
    margin-top: 16px;
    padding: 14px 18px;
    background: #f8fafc;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.validation-check {
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.5;
    border-bottom: 1px solid #f1f5f9;
}

.validation-check:last-child {
    border-bottom: none;
}

.validation-check.check-pass {
    color: #166534;
}

.validation-check.check-fail {
    color: #991b1b;
}

/* ============================================
   TEMPLATE IMAGES PANEL (collapsible, inside modal)
   ============================================ */

.images-sidebar {
    flex-shrink: 0;
    width: 300px;
    max-height: 100%;
    background: #fff;
    border-left: 1px solid #dee2e6;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.images-sidebar.collapsed {
    display: none;
}

.images-sidebar h4 {
    margin: 0;
    padding: 1rem;
    background: #f7f7f7;
    border-bottom: 1px solid #ddd;
    font-size: 1rem;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.images-hint {
    margin: 0;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    color: #856404;
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
}

#images-list {
    padding: 1rem;
    max-height: calc(80vh - 60px);
    overflow-y: auto;
}

.image-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    background: #fafafa;
    transition: all 0.2s ease;
}

.image-item:hover {
    background: #f0f7ff;
    border-color: #007cba;
}

.image-preview img {
    border-radius: 4px;
    border: 1px solid #ddd;
    display: block;
}

.image-info {
    flex: 1;
    min-width: 0;
}

.image-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.image-details {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.35rem;
}

.image-size-hint {
    font-size: 0.75rem;
    color: #856404;
    background: #fff8e1;
    border-radius: 3px;
    padding: 0.2rem 0.4rem;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.btn-replace-image {
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-replace-image:hover {
    background: #005a87;
}

.no-images {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 2rem;
}

/* ============================================
   EDITOR HELP PANEL
   ============================================ */

.editor-help-bar {
    padding: 0.5rem 1.5rem;
    background: #f9f9f9;
    border-bottom: 1px solid #e1e5e9;
    flex-shrink: 0;
    overflow-y: auto;
    max-height: 45vh;
}

.btn-help {
    background: #f0f0f0;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 0.3em 0.8em;
    font-size: 0.85em;
    cursor: pointer;
    color: #333;
}

.btn-help:hover {
    background: #e2e2e2;
}

.editor-help-content {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.help-columns {
    display: flex;
    gap: 2rem;
}

.help-column {
    flex: 1;
    min-width: 0;
}

.help-column h5 {
    margin: 0 0 0.4rem 0;
    color: #333;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.help-column ul {
    margin: 0 0 0.8rem 0;
    padding-left: 1.2rem;
}

.help-column li {
    margin-bottom: 0.25rem;
    color: #555;
}

.help-column code {
    background: #f0f0f0;
    padding: 0.1em 0.35em;
    border-radius: 3px;
    font-size: 0.9em;
}

@media (max-width: 900px) {
    .help-columns {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ============================================
   RESPONSIVE: IMAGES PANEL
   ============================================ */

@media (max-width: 1400px) {
    .images-sidebar {
        width: 100%;
        max-height: 250px;
        border-left: none;
        border-top: 1px solid #dee2e6;
    }

    .split-screen-body {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .image-item {
        flex-direction: column;
        text-align: center;
    }

    .image-preview {
        align-self: center;
    }
}
