/* Import Roboto Condensed font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;600;700&display=swap');

body {
    /* Updated font-family to Aptos with Segoe UI fallback */
    font-family: "Aptos", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    background-color: #f4f7f6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 10px;
    color: rgb(50, 49, 48);
}
.container {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    min-width: 400px; /* Added minimum width constraint */
    margin-top: 10px;
}

h1, h2, h3, h4, h5, h6 {
    /* Updated font-family to Roboto Condensed */
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    font-weight: 700;
    margin-bottom: 0.5em;
}

/* ===================================
   Header Styling
   =================================== */

/* Header container */
.header-container {
    position: relative;
    padding-bottom: 15px; /* Reduced to eliminate extra space */
    margin-bottom: 15px;
    width: 100%;
}

/* Header top row - main flex container */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
}

/* Logo and title container */
.logo-title {
    display: flex;
    align-items: center;
}

/* Desktop logo */
.desktop-logo {
    height: 50px;
    margin-right: 15px;
    display: block;
}

/* Mobile logo */
.mobile-logo {
    height: 40px;
    margin-right: 10px;
    display: none;
}

/* Page title */
/* Page title - corrected implementation */
/* Updated specific h1 style that will take precedence */
h1, .logo-title h1 {
    font-size: 2.5rem !important; /* Force larger size, keeping !important as it seems needed to override other styles */
    color: #333;
    margin-left: 15px;
    font-weight: 700 !important; /* Force bold weight */
    white-space: nowrap;
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif !important;
    line-height: 1.1; /* Tighter line height for better appearance */
}

/* Navigation links container */
.header-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-left: auto;
}

/* Individual nav links */
.nav-link {
    color: #00b2a9;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.nav-link:hover {
    color: #008c86;
}

/* Hamburger icon - hidden by default */
.hamburger-icon {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 24px;
    cursor: pointer;
    padding: 0;
    margin-left: 15px;
}

.hamburger-icon .bar {
    width: 100%;
    height: 3px;
    background-color: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Search button */
.header-search-button {
    position: relative; /* Changed from absolute to reduce spacing */
    bottom: auto;
    left: auto;
    width: 100%;
    margin-top: 15px;
    margin-bottom: 0;
    background-color: #00b2a9;
}

/* Results stats */
.results-stats {
    text-align: right;
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
    margin-bottom: 5px;
}

/* ===================================
   Form Styling
   =================================== */

.search-form {
    margin-top: 0;
}

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

.form-container {
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 0; /* No extra space at top */
    margin-bottom: 25px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section-title {
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #00b2a9;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 8px;
}
label {
    display: flex;
    margin-bottom: 8px;
    font-weight: 600;
    color: rgb(50, 49, 48);
    font-size: 12px;
    align-items: center;
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
.field-icon {
    display: inline-flex;
    margin-right: 8px;
    width: 16px;
    height: 16px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #605e5c;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 12px;
    font-weight: 600;
    transition: border-color 0.2s ease;
    font-family: "Aptos", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
input[type="text"]:hover {
    border-color: #323130;
}
input[type="text"]:focus {
    border-color: #0078d4;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

select.form-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 12px;
    font-weight: 600;
    background-color: white;
    font-family: "Aptos", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat, repeat;
    background-position: right .7em top 50%, 0 0;
    background-size: .65em auto, 100%;
}

select.form-select:hover {
    border-color: #323130;
}

select.form-select:focus {
    border-color: #0078d4;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}
.error-message {
    color: #d83b01;
    font-size: 12px;
    margin-top: 5px;
}
.field-help {
    color: #605e5c;
    font-size: 11px;
    margin-top: 4px;
    font-weight: normal;
}

/* ===================================
   Button Styling
   =================================== */

.action-button {
    padding: 12px;
    background-color: #00b2a9;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.action-button i {
    margin-right: 8px;
}

.action-button:hover {
    background-color: #009990;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.action-button:active {
    transform: translateY(1px);
}

.action-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 178, 169, 0.3);
}

/* Results actions container */
.results-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 15px;
    margin-top: 15px; /* Added proper top margin */
    width: 100%;
}

/* Cancel button - Removed !important */
.action-button.cancel-button {
    background-color: #f0f0f0; /* Light grey */
    color: #333;
    border: 1px solid #ccc;
}

.action-button.cancel-button:hover {
    background-color: #FFFFFF; /* White on hover */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Specific targeting for the results area button - Removed !important */
#resultsButtonsContainer .action-button.cancel-button {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
}

#resultsButtonsContainer .action-button.cancel-button:hover {
    background-color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.secondary-button {
    background-color: #6e7e85;
}

.secondary-button:hover {
    background-color: #5a686e;
}

/* Button groups */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.button-group button {
    flex-grow: 1;
    width: auto;
    margin-top: 0;
}

/* ===================================
   Results Area Styling
   =================================== */

#resultsArea {
    margin-top: 0; /* No extra spacing at top */
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    min-width: 800px; /* Ensure minimum width to accommodate all data */
}

.table-container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 20px;
    max-height: 70vh; /* Add max height to enable vertical scrolling */
    overflow-y: auto; /* Enable vertical scrolling within the container */
}
th, td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}
th {
    background-color: #f2f2f2;
    font-weight: bold;
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    /* Sticky header implementation */
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Styles for sortable columns */
th.sortable {
    cursor: pointer;
    user-select: none;
    padding-right: 25px; /* Make room for the sort icon */
}

th.sortable:hover {
    background-color: #e8e8e8;
}

th.sortable::after {
    content: '\f0dc'; /* Default unsorted icon (bars) */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 8px;
    color: #999;
}

th.sortable.asc::after {
    content: '\f0de'; /* Sorted ascending icon (up arrow) */
    color: #00b2a9;
}

th.sortable.desc::after {
    content: '\f0dd'; /* Sorted descending icon (down arrow) */
    color: #00b2a9;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}
tr:hover {
    background-color: #e9e9e9;
}

/* ===================================
   Lazy Loading Elements
   =================================== */

/* NEW: Lazy Load Observer Styling */
.lazy-load-observer {
    height: 40px;
    background-color: #f0f8ff;
    border: 2px dashed #00b2a9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    font-size: 14px;
    color: #00b2a9;
    font-weight: 600;
    transition: all 0.3s ease;
}

.lazy-load-observer:hover {
    background-color: #e6f3ff;
    border-color: #008c86;
    color: #008c86;
}

/* Table loading indicator */
.table-loading {
    text-align: center;
    padding: 20px;
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.table-loading-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

/* ===================================
   Helper Classes
   =================================== */

.hidden {
    display: none !important; /* Make sure hidden means completely gone */
}

/* Loading spinner */
.loader {
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid #00b2a9;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

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

/* Accessibility helper */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Loading state */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

/* ===================================
   Tooltip Styling
   =================================== */

.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    margin-left: 6px;
}

.tooltip-icon {
    display: inline-flex;
    color: #6e7e85;
    cursor: pointer;
    width: 16px;
    height: 16px;
    position: relative;
    align-items: center;
    justify-content: center;
}

.tooltip-icon:hover {
    color: #00b2a9;
}

.tooltip-content {
    /* Ensure tooltip content is hidden by default */
    display: none;
    position: absolute;
    /* Positioning relative to the tooltip-icon */
    top: 100%; /* Position below the icon */
    /* *** MODIFIED FOR LEFT ALIGNMENT *** */
    left: 0; /* Align left edge with the icon's left edge */
    transform: translateX(0); /* Remove horizontal centering transform */
    /* *** END MODIFIED *** */
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 15px;
    width: 280px; /* Keep the width as is */
    z-index: 100;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    font-size: 12px;
    font-weight: normal;
    color: #323130;
    margin-top: 8px;
    line-height: 1.5;
    text-align: left;
    white-space: normal; /* Allow text to wrap */
}

/* Arrow for tooltip - adjusted position */
.tooltip-content::before {
    content: '';
    position: absolute;
    bottom: 100%; /* Position above the tooltip content */
    /* *** MODIFIED FOR LEFT ALIGNMENT *** */
    left: 8px; /* Position the arrow near the left edge, adjust as needed */
    transform: translateX(0); /* Remove transform */
    /* *** END MODIFIED *** */
    border-width: 0 8px 8px 8px;
    border-style: solid;
    border-color: transparent transparent #e0e0e0 transparent;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    bottom: 100%; /* Position above the tooltip content */
    /* *** MODIFIED FOR LEFT ALIGNMENT *** */
    left: 8px; /* Position the arrow near the left edge, adjust as needed */
    transform: translateX(0); /* Remove transform */
    /* *** END MODIFIED *** */
    border-width: 0 8px 8px 8px;
    border-style: solid;
    border-color: transparent transparent white transparent;
}

/* Show tooltip content on hover of the wrapper */
.tooltip-wrapper:hover .tooltip-content {
    display: block;
}

/* ===================================
   Modal Styling
   =================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none; /* Changed from flex to none for better control */
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    text-align: center;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.message-icon-container {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
}

.message-icon-container i {
    font-size: 30px;
    color: #605e5c;
}

.message-icon-container .error {
    color: #d13438;
}

.message-icon-container .success {
    color: #107c10;
}

.message-icon-container .info {
    color: #0078d4;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    width: auto;
    padding: 8px 25px;
    margin-top: 0;
    min-width: 100px;
    font-size: 1rem;
}

#closeMessageBox {
    background-color: #00b2a9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#closeMessageBox:hover {
    background-color: #009990;
}

#closeMessageBox:active {
    transform: translateY(1px);
}

/* ===================================
   Mobile Menu
   =================================== */

/* Animation for hamburger icon when active */
.hamburger-icon.active .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-icon.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger-icon.active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu */
.mobile-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    background-color: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 15px 0;
    margin-top: 5px;
    margin-bottom: 15px;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu .nav-link {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 16px;
}

.mobile-menu .nav-link:last-child {
    border-bottom: none;
}

/* ===================================
   Responsive Breakpoints
   =================================== */

/* Tablet breakpoint */
@media (max-width: 900px) and (min-width: 601px) {
    .desktop-logo {
        height: 40px;
        margin-right: 10px;
    }

    h1, .logo-title h1 {
        font-size: 2rem !important; /* Still quite large at tablet size */
    }

    .header-nav {
        gap: 15px;
    }
    
    /* Fix for missing input border at tablet width */
    .form-container {
        padding: 20px;
        overflow: visible;
    }
    
    input[type="text"] {
        margin-bottom: 8px; /* Add breathing room to prevent overlap */
    }
}

/* Mobile breakpoint */
@media (max-width: 600px) {
    .header-top-row {
        justify-content: space-between;
    }

    .logo-title {
        flex: 1;
    }

    .desktop-logo {
        display: none;
    }

    .mobile-logo {
        display: block;
    }

    h1, .logo-title h1 {
        font-size: 1.8rem !important; /* Slightly larger than before */
    }

    .hamburger-icon {
        display: flex;
    }

    .header-nav {
        display: none;
    }

    .results-stats {
        text-align: right;
    }

    /* Mobile lazy load observer adjustments */
    .lazy-load-observer {
        height: 35px;
        font-size: 12px;
        margin: 10px 0;
    }
}

/* Directory Modal CSS */
.directory-modal {
    max-width: 600px;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f6f6f6;
    padding: 15px 20px;
    border-bottom: 1px solid #eaeaea;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

.close-button {
    background: none;
    border: none;
    font-size: 18px;
    color: #888;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.close-button:hover {
    color: #333;
}

.directory-section {
    padding: 15px 20px;
    border-bottom: 1px solid #eaeaea;
}

.directory-section h4 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: #444;
}

.download-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.format-button {
    display: inline-block;
    padding: 6px 15px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    color: white;
    text-decoration: none;
    transition: all 0.2s;
    font-family: "Roboto Condensed", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.format-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* TEXT button - switched colors */
.text-button {
    background-color: #3a80d2; /* Previously hover color */
}

.text-button:hover {
    background-color: #4a90e2; /* Previously normal color */
}

/* CSV button - switched colors */
.csv-button {
    background-color: #e59613; /* Previously hover color */
}

.csv-button:hover {
    background-color: #f5a623; /* Previously normal color */
}

/* XLS button - switched colors */
.xls-button {
    background-color: #6ec311; /* Previously hover color */
}

.xls-button:hover {
    background-color: #7ed321; /* Previously normal color */
}

/* XML button - switched colors */
.xml-button {
    background-color: #ad00d0; /* Previously hover color */
}

.xml-button:hover {
    background-color: #bd10e0; /* Previously normal color */
}

.modal-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    background-color: #f6f6f6;
}

.modal-footer .action-button {
    background-color: #00b2a9;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-footer .action-button:hover {
    background-color: #009990;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .download-buttons {
        justify-content: center;
    }
    
    .format-button {
        padding: 8px 12px;
        flex: 1;
        min-width: 70px;
    }
    
    .directory-modal {
        width: 95%;
    }
}