/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: #fafafa;
    color: #333;
    line-height: 1.6;
    margin: 0; /* Ensure no default body margin */
}

/* Container for centered content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
header {
    background-color: #333; /* Dark background */
    border-bottom: 1px solid #444; /* Slightly lighter border for contrast */
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0; /* Ensure no margin */
    padding: 0; /* Remove any padding */
}

nav {
    padding: 1.5rem 0; /* Keep internal padding for nav content */
    margin: 0; /* Ensure no margin */
}

.nav-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.nav-header {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-links a {
    text-decoration: none;
    color: #fff; /* White text */
    font-weight: 600;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #4a90e2; /* Muted blue on hover */
}

.nav-search {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

#search-box {
    padding: 0.5rem 1rem;
    border: 1px solid #666; /* Slightly lighter border for contrast */
    border-radius: 20px;
    background-color: #555; /* Darker background */
    color: #fff; /* White text */
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
    width: 200px;
}

#search-box:focus {
    border-color: #4a90e2;
}

#search-box::placeholder {
    color: #ccc; /* Light gray placeholder text for readability */
}

#search-result {
    background-color: #444; /* Dark background to match the header */
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); /* Darker shadow */
    font-size: 0.9rem;
    color: #fff; /* White text */
    display: none; /* Hidden by default */
    margin-top: 0.5rem;
}

#search-result.show {
    display: block;
}

/* Admin Page */
#update-all-dates {
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    background-color: #ff6347; /* Orange to match your "Reset Filters" button */
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#update-all-dates:hover {
    background-color: #e5533d; /* Darker orange on hover */
}

/* Main Content */
main h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Background video section */
#background-video-section {
    position: relative; /* Required for absolute positioning of the overlay and title */
    width: 100vw; /* Full viewport width */
    height: 35vh; /* Adjusted to better fit 2.35:1 aspect ratio */
    overflow: hidden;
    margin: 0; /* Remove all margins except bottom */
    margin-bottom: 2rem; /* Add space below the video section */
    margin-left: calc(-1 * (100vw - 100%) / 2); /* Offset the container's padding */
    margin-right: calc(-1 * (100vw - 100%) / 2); /* Offset the container's padding */
    padding: 0; /* Remove any padding */
    background-color: #000; /* Fallback background color */
}

#background-video {
    display: block; /* Ensure the video is a block element */
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures the video covers the section while maintaining aspect ratio */
    object-position: center; /* Centers the video */
    position: absolute; /* Ensure it fills the section */
    top: 0;
    left: 0;
    z-index: 0; /* Place the video behind the overlay and title */
}

/* Dark overlay for the video */
#background-video-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3); /* Dark overlay with 30% opacity */
    z-index: 1;
}

/* Style the title over the video */
#background-video-section h1 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center the title */
    color: #fff; /* White text for readability */
    font-size: 3.5rem; /* Slightly smaller to fit the shorter section */
    font-weight: 700; /* Extra bold */
    text-align: center;
    z-index: 2; /* Ensure the title is above the overlay */
    margin: 0; /* Remove default margin */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); /* Subtle shadow for better readability */
    width: 75%; /* Span 75% of the video section */
    max-width: 90vw; /* Prevent overflow on smaller screens */
}

/* Content section (filters and updates) */
#content-section {
    max-width: 1200px; /* Match the .container max-width */
    margin: 0 auto; /* Center the content */
    padding: 0 1.5rem; /* Match the .container padding */
}

/* Updates section (home page) */
#updates p {
    background-color: #fff;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-size: 0.95rem;
    color: #444;
}

/* Home page filters */
#filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

#filters select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    background-color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
    width: 200px;
    appearance: none; /* Remove default browser styling */
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>'); /* Custom dropdown arrow */
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

#filters select:focus {
    border-color: #4a90e2;
    outline: none;
}

#filters button {
    padding: 0.5rem 1rem;
    background-color: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#filters button:hover {
    background-color: #c0392b;
}

/* Style the sort dropdown on the browse page to match the home page dropdowns */
#sort-options select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    background-color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
    width: 200px;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

#sort-options select:focus {
    border-color: #4a90e2;
    outline: none;
}

/* Add more spacing below the sort-options section */
#sort-options {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: center;
}

/* Ensure bold text in the updates list matches the design */
#airline-list p a strong,
#airline-list p strong {
    font-weight: 600;
}

/* Browse page region buttons */
#region-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.region-button {
    padding: 0.75rem 1.5rem;
    background-color: #fff;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.region-button:hover {
    background-color: #f9f9f9;
    border-color: #4a90e2;
    color: #4a90e2;
}

.region-button.active {
    background-color: #4a90e2;
    color: #fff;
    border-color: #4a90e2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Add shadow */
    font-weight: 700; /* Bold text */
    transform: scale(1.05); /* Slight scale-up */
}

/* Airline list (browse page) */
#airline-list div {
    background-color: #fff;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#airline-list div:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#airline-list h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.5rem;
}

#airline-list p {
    font-size: 0.9rem;
    color: #666;
}

/* Airline details */
#airline-details {
    margin-top: 2rem;
}

#airline-name {
    font-size: 2rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 2rem;
}

.info-block {
    background-color: #fff;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.info-block h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 1rem;
}

.info-block p {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.info-block ul {
    list-style: disc;
    padding-left: 1.5rem;
    font-size: 0.95rem;
    color: #666;
}

.info-block ul li {
    margin-bottom: 0.5rem;
}

/* Header block for airline name and meta */
.header-block {
    margin-bottom: 2rem;
    text-align: center;
}

#airline-meta {
    font-size: 1rem;
    color: #666;
    margin-top: 0.5rem;
}

/* Update date styling */
.update-date {
    font-size: 0.9rem;
    color: #666;
    float: right;
}

/* Side-by-side layout for Pension and Medical Insurance */
.side-by-side {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.side-by-side .info-block {
    flex: 1;
}

/* Hiring status styling */
.hiring-status {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.hiring-status div {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.hiring-status .positive {
    background-color: #2ecc71;
    color: #fff;
}

.hiring-status .negative {
    background-color: #e74c3c;
    color: #fff;
}

.hiring-status .na {
    background-color: #ccc;
    color: #fff;
}

/* Hiring requirements table */
#hiring-requirements table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #666;
}

#hiring-requirements table th,
#hiring-requirements table td {
    padding: 0.75rem;
    border: 1px solid #eee;
    text-align: left;
}

#hiring-requirements table th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: #333;
}

#hiring-requirements table ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 0;
}

/* Fleet table */
.info-block table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #666;
}

.info-block table th,
.info-block table td {
    padding: 0.75rem;
    border: 1px solid #eee;
    text-align: left;
}

.info-block table th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: #333;
}

/* Admin form */
#admin-form {
    background-color: #fff;
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#admin-form h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

#admin-form h3 {
    font-size: 1.1rem;
    margin: 1rem 0;
}

#airline-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#airline-form input,
#airline-form select,
#airline-form textarea {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

#airline-form input:focus,
#airline-form select:focus,
#airline-form textarea:focus {
    border-color: #4a90e2;
}

#airline-form button {
    padding: 0.75rem;
    background-color: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#airline-form button:hover {
    background-color: #357abd;
}

/* Position inputs */
.position-input {
    margin-bottom: 0.5rem;
}

.position-input input,
.position-input select,
.position-input textarea {
    width: 100%;
    margin-bottom: 0.5rem;
}

#hiring-positions > div {
    margin-bottom: 1rem;
}

/* Buttons for adding/removing positions */
#admin-form button[id$="-position"] {
    padding: 0.5rem 1rem;
    margin: 0.5rem 0.5rem 1rem 0;
    background-color: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#admin-form button[id$="-position"]:hover {
    background-color: #357abd;
}

#admin-form button[id^="remove-"] {
    background-color: #e74c3c;
}

#admin-form button[id^="remove-"]:hover {
    background-color: #c0392b;
}

/* Dynamic table inputs (payscale, additional pay, benefits) */
#payscale-rows div,
#additional-pay-rows div,
#additional-benefits-rows div,
#fleet-rows div {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

#payscale-rows input,
#additional-pay-rows input,
#additional-benefits-rows input,
#fleet-rows input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
}

#payscale-rows button,
#additional-pay-rows button,
#additional-benefits-rows button,
#fleet-rows button {
    padding: 0.5rem 1rem;
    background-color: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

#payscale-rows button:hover,
#additional-pay-rows button:hover,
#additional-benefits-rows button:hover,
#fleet-rows button:hover {
    background-color: #c0392b;
}

#add-payscale-row,
#add-additional-pay-row,
#add-additional-benefits-row,
#add-fleet-row {
    padding: 0.5rem 1rem;
    background-color: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

#add-payscale-row:hover,
#add-additional-pay-row:hover,
#add-additional-benefits-row:hover,
#add-fleet-row:hover {
    background-color: #357abd;
}

/* Airline list table */
#airline-table {
    margin: 1rem 0;
}

#airline-table div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#airline-table p {
    font-size: 0.9rem;
    color: #666;
}

#airline-table button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.3s ease;
}

#airline-table button.edit {
    background-color: #4a90e2;
    color: #fff;
}

#airline-table button.edit:hover {
    background-color: #357abd;
}

#airline-table button.delete {
    background-color: #e74c3c;
    color: #fff;
}

#airline-table button.delete:hover {
    background-color: #c0392b;
}

/* Download button */
#download-json {
    padding: 0.75rem 1.5rem;
    background-color: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#download-json:hover {
    background-color: #27ae60;
}

/* Headings */
h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 2rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-row {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a {
        font-size: 0.9rem;
    }

    #search-box {
        width: 100%;
        max-width: 250px;
        font-size: 0.85rem;
    }

    #search-result {
        margin: 0.5rem 0;
        text-align: center;
    }

    #filters {
        flex-direction: column;
        align-items: center;
    }

    #filters select {
        width: 100%;
        max-width: 300px;
    }

    #filters button {
        width: 100%;
        max-width: 300px;
    }

    #region-buttons {
        gap: 0.75rem;
    }

    .region-button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    #background-video-section {
        height: 30vh; /* Adjusted from 40vh to 30vh */
    }

    #background-video-section h1 {
        font-size: 2.5rem; /* Adjusted from 3rem to 2.5rem */
        width: 85%;
    }

    h1 {
        font-size: 1.5rem;
    }

    #airline-name {
        font-size: 1.6rem;
    }

    .info-block {
        padding: 1rem;
    }

    .info-block h2 {
        font-size: 1.2rem;
    }

    .info-block p,
    .info-block ul {
        font-size: 0.9rem;
    }

    .info-block table {
        font-size: 0.9rem;
    }

    .info-block table th,
    .info-block table td {
        padding: 0.5rem;
    }

    .update-date {
        float: none;
        display: block;
        margin-top: 0.5rem;
    }

    .hiring-status {
        flex-direction: column;
        gap: 0.5rem;
    }

    .side-by-side {
        flex-direction: column;
        gap: 0;
    }

    .side-by-side .info-block {
        margin-bottom: 1.5rem;
    }

    #airline-form {
        gap: 0.75rem;
    }

    #payscale-rows div,
    #additional-pay-rows div,
    #additional-benefits-rows div,
    #fleet-rows div {
        flex-direction: column;
    }

    #airline-table div {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    #airline-table button {
        width: 100%;
        margin: 0.25rem 0;
    }
}

@media (max-width: 480px) {
    .nav-row {
        gap: 0.75rem;
    }

    .nav-links {
        gap: 0.75rem;
    }

    .nav-links a {
        font-size: 0.85rem;
    }

    #search-box {
        max-width: 200px;
        font-size: 0.8rem;
    }

    #region-buttons {
        gap: 0.5rem;
    }

    .region-button {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    #background-video-section {
        height: 25vh; /* Adjusted from 30vh to 25vh */
    }

    #background-video-section h1 {
        font-size: 1.8rem; /* Adjusted from 2.2rem to 1.8rem */
        width: 90%;
    }

    #airline-list div {
        padding: 1rem;
    }

    #airline-list h2 {
        font-size: 1.1rem;
    }

    #airline-name {
        font-size: 1.4rem;
    }

    .info-block {
        padding: 0.75rem;
    }

    .info-block table {
        font-size: 0.85rem;
    }

    .info-block table th,
    .info-block table td {
        padding: 0.4rem;
    }
}

/* Loading Spinners During Data Fetch */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4a90e2;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}

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

/* Form Validation Feedback */
.error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: none;
}

input:invalid:focus,
textarea:invalid:focus,
select:invalid:focus {
    border-color: #e74c3c;
}