/* ============================================
    style.css
   VARIABLES
   ============================================ */
:root {
    --primary-color: #5cb85c;
    --dark-bg: #2c3e50;
    --light-gray: #f8f9fa;
}
/* ============================================
   BASE STYLES
   ============================================ */
body {
    background-color: var(--light-gray);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
/* ============================================
   TOP BAR
   ============================================ */
.top-bar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}
/* ============================================
   SEARCH & FILTERS
   ============================================ */
.search-filters-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}
.search-box {
    position: relative;
}
.search-box input {
    padding-left: 2.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}
/* ============================================
   BUTTONS
   ============================================ */
.btn-filters {
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 6px;
    padding: 0.5rem 1.5rem;
}
.btn-upload {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
}
.btn-upload:hover {
    background-color: #4cae4c;
    color: white;
}
/* ============================================
   TABLES
   ============================================ */
.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.data-table {
    margin-bottom: 0;
    table-layout: fixed;
    width: 100%;
}
.data-table thead {
    background-color: var(--dark-bg);
    color: white;
}
.data-table thead th {
    padding: 1rem;
    font-weight: 600;
    text-align: left;
    border: none;
}
.data-table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
    text-align: left;
}
.data-table tbody tr:hover {
    background-color: #f8f9fa;
}
/* Column widths for reports table */
.data-table thead th:nth-child(1),
.data-table tbody td:nth-child(1) { width: 25%; }
.data-table thead th:nth-child(2),
.data-table tbody td:nth-child(2) { width: 18%; }
.data-table thead th:nth-child(3),
.data-table tbody td:nth-child(3) { width: 28%; }
.data-table thead th:nth-child(4),
.data-table tbody td:nth-child(4) { width: 19%; }
.data-table thead th:nth-child(5),
.data-table tbody td:nth-child(5) { width: 10%; }
/* Ellipsis for File Name */
.data-table tbody td:nth-child(1) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Error table */
.error-table {
    table-layout: fixed;
    width: 100%;
}
.error-table thead th:nth-child(1),
.error-table tbody td:nth-child(1) { width: 15%; }
.error-table thead th:nth-child(2),
.error-table tbody td:nth-child(2) { width: 10%; }
.error-table thead th:nth-child(3),
.error-table tbody td:nth-child(3) { width: 15%; }
.error-table thead th:nth-child(4),
.error-table tbody td:nth-child(4) { width: 20%; }
.error-table thead th:nth-child(5),
.error-table tbody td:nth-child(5) { width: 40%; }
/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    background-color: #d4edda;
    color: #155724;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;   /* prevent text from wrapping and stretching */
}
.status-badge.error {
    background-color: #f8d7da;
    color: #721c24;
}
.status-badge.warning {
    background-color: #fff3cd;
    color: #856404;
    white-space: nowrap;
}
/* ============================================
   ERROR TYPE BADGES
   ============================================ */
.error-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}
.error-type-critical {
    background-color: #f8d7da;
    color: #721c24;
}
.error-type-warning {
    background-color: #fff3cd;
    color: #856404;
}
.error-type-info {
    background-color: #d1ecf1;
    color: #0c5460;
}
/* ============================================
   LINKS
   ============================================ */
.link-download {
    color: #5cb85c;
    text-decoration: none;
    font-weight: 500;
}
.link-download:hover {
    text-decoration: underline;
}
/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
}
/* ============================================
   MODALS
   ============================================ */
.modal-content {
    border-radius: 12px;
    border: none;
}
.modal-header {
    border-bottom: 1px solid #eee;
    padding: 1.5rem;
}
.modal-body {
    padding: 2.5rem;
}
/* ============================================
   UPLOAD ZONE
   ============================================ */
.upload-zone {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}
.upload-zone:hover {
    border-color: var(--primary-color);
    background-color: #f8fff8;
}
.upload-zone.dragover {
    border-color: var(--primary-color);
    background-color: #f0f9f0;
}
.upload-icon {
    font-size: 3rem;
    color: #999;
    margin-bottom: 1rem;
}
/* ============================================
   VALIDATION MODAL
   ============================================ */
.validation-modal .modal-body {
    text-align: center;
    padding: 3rem 2rem;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Base: used by success modal ("Validation Completed" — green) */
.validation-complete {
    display: flex;
    align-items: center;
    justify-content: left;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 2rem;
}
/* XSD failed — red */
.validation-complete.failed-xsd {
    color: #dc3545;
}
/* Business rule failed — orange */
.validation-complete.failed-br {
    color: #e67e22;
}
/* Warning state */
.validation-warning {
    display: flex;
    align-items: center;
    justify-content: left;
    gap: 0.5rem;
    color: #e67e22;
    font-weight: 600;
    margin-bottom: 2rem;
}
/* ============================================
   ERROR LIST
   ============================================ */
.error-list {
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1rem;
}
.error-item {
    padding: 0.75rem;
    border-left: 3px solid #dc3545;
    background: #fff5f5;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}
.no-errors {
    text-align: center;
    padding: 2rem;
    color: #999;
}
/* ============================================
   LIST STYLES
   ============================================ */
ul.small li {
    color: black;
}
ul.small li.critical::marker {
    color: red;
}
ul.small li.warning::marker {
    color: orange;
}
/* ============================================
   DELETE MODAL
   ============================================ */
#deleteConfirmModal .modal-header,
#deleteConfirmModal .modal-body,
#deleteConfirmModal .modal-footer {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}
#deleteConfirmModal .modal-body p {
    margin-bottom: 0.2rem;
}
#deleteConfirmModal .modal-footer {
    border-top: none;
}
#deleteConfirmModal .modal-dialog {
    max-width: 380px;
    margin: 1.75rem auto;
}
/* ============================================
   ALERTS
   ============================================ */
.alert {
    margin-top: -30px;
}
/* ============================================
   DROPDOWN
   ============================================ */
.dropdown-menu {
    min-width: 200px;
}
.dropdown-item {
    padding: 10px 20px;
    transition: background-color 0.2s;
}
.dropdown-item:hover {
    background-color: #f8f9fa;
}
.dropdown-item i {
    color: #6c757d;
}

/* ============================================
   RESPONSIVE — TABLET (max 768px)
   ============================================ */
@media (max-width: 768px) {

    /* Top bar */
    .top-bar {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Search filters — stack vertically */
    .search-filters-section .row > div {
        margin-bottom: 0.5rem;
    }
    .search-filters-section .col-md-5.text-end {
        text-align: left !important;
    }

    /* Upload button full width */
    .btn-upload,
    .dropdown-toggle.btn-upload {
        width: 100%;
    }

    /* Table — make scrollable horizontally */
    .table-container {
        overflow-x: auto;
    }
    .data-table {
        table-layout: auto;
        min-width: 600px;
    }
    .data-table thead th:nth-child(1),
    .data-table tbody td:nth-child(1),
    .data-table thead th:nth-child(2),
    .data-table tbody td:nth-child(2),
    .data-table thead th:nth-child(3),
    .data-table tbody td:nth-child(3),
    .data-table thead th:nth-child(4),
    .data-table tbody td:nth-child(4),
    .data-table thead th:nth-child(5),
    .data-table tbody td:nth-child(5) {
        width: auto;
    }

    /* Status badge — allow wrap only for non-warning badges on very small screens */
    .status-badge:not(.warning) {
        white-space: normal;
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }
    .status-badge.warning {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    /* Modal body padding */
    .modal-body {
        padding: 1.5rem;
    }

    /* Upload zone */
    .upload-zone {
        padding: 2rem 1rem;
    }

    /* Summary modal buttons — stack */
    #summarySuccess .d-flex,
    #summaryError .d-flex {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    #summarySuccess .d-flex button,
    #summaryError .d-flex button {
        width: 100%;
    }

    /* Error detail toolbar buttons — stack */
    .search-filters-section .col-md-5.text-end button {
        width: 100%;
        margin-bottom: 0.4rem;
        margin-right: 0 !important;
    }

    /* Pagination */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start !important;
    }
}

/* ============================================
   RESPONSIVE — MOBILE (max 480px)
   ============================================ */
@media (max-width: 480px) {

    /* Container padding */
    .container-fluid.px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Top bar */
    .top-bar {
        padding: 0.5rem 0.75rem;
    }
    .top-bar h5 {
        font-size: 0.85rem;
    }

    /* Table font size */
    .data-table {
        font-size: 0.8rem;
    }
    .data-table thead th,
    .data-table tbody td {
        padding: 0.6rem 0.5rem;
    }

    /* Hide Date column on very small screens */
    .data-table thead th:nth-child(2),
    .data-table tbody td:nth-child(2) {
        display: none;
    }

    /* Search box */
    .search-filters-section {
        padding: 1rem;
    }

    /* Modal fullscreen on mobile */
    #summaryModal .modal-dialog,
    #uploadModal .modal-dialog {
        margin: 0;
        max-width: 100%;
    }
    #summaryModal .modal-content,
    #uploadModal .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    /* Upload zone */
    .upload-zone {
        padding: 1.5rem 0.75rem;
    }
    .upload-icon {
        font-size: 2rem;
    }

    /* Spinner */
    .spinner {
        width: 36px;
        height: 36px;
    }

    /* Alerts position */
    .alert.position-fixed {
        left: 0.5rem !important;
        right: 0.5rem !important;
        min-width: unset !important;
    }
}