/* Reset & base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    visibility: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Content */
.main-content {
    padding: clamp(1rem, 2vw, 1.5rem);
    flex: 1;
    /* Ensure main content takes available space */
}

/* Title */
h1 {
    text-align: center;
    color: var(--dark-color);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

/* ========== SEARCH SECTION ========== */
.search-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto clamp(1rem, 2vw, 1.5rem);
    max-width: 100%;
}

#searchToggle {
    background: #5a5959;
    border: none;
    color: white;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    padding: clamp(8px, 1.5vw, 10px) clamp(12px, 2vw, 15px);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#searchToggle:hover {
    background: #333333;
}

#searchInput {
    width: 0;
    padding: clamp(8px, 1.5vw, 10px) clamp(12px, 2vw, 15px);
    margin-left: 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: clamp(0.9rem, 1.8vw, 1rem);
    opacity: 0;
    pointer-events: none;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.search-container.active #searchInput {
    width: clamp(150px, 30vw, 200px);
    opacity: 1;
    pointer-events: auto;
    border-color: #7f8c8d;
}

#searchInput:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 5px rgba(10, 141, 60, 0.3);
}

/* ========== FILTER CHECKBOXES ========== */
.filters {
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    display: flex;
    gap: clamp(10px, 1.5vw, 15px);
    justify-content: center;
    flex-wrap: wrap;
}

.filters label {
    font-weight: 500;
    color: var(--dark-color);
    user-select: none;
    cursor: pointer;
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
}

.filters input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ========== HIGHLIGHT TAGS ========== */
.highlight {
    display: inline-block;
    background: yellow;
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: clamp(0.8rem, 1.5vw, 0.85rem);
    margin-top: 8px;
    margin-right: 8px;
    font-weight: 500;
}

/* ========== JOB LIST SECTION ========== */
.job-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: clamp(1.2rem, 2vw, 1.8rem);
    padding: 0 clamp(0.5rem, 1.5vw, 0.8rem);
    max-width: 1200px;
    margin: 0 auto clamp(2rem, 3vw, 4rem);
    user-select: none;
    opacity: 0;
    animation: fadeInUp 0.6s forwards;
}

/* Job Card */
.job-card {
    background: var(--card-background-color);
    border-radius: 16px;
    padding: clamp(15px, 2vw, 20px);
    color: #d4f8e8;
    box-shadow: 0 8px 15px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
}

.job-card:hover,
.job-card:hover h3,
.job-card:hover p,
.job-card:hover a {
    color: var(--text-color-light);
}

.job-card:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.8);
}

.job-card h3 {
    margin-bottom: 0.6rem;
    font-size: clamp(1.1rem, 2vw, 1.2rem);
    font-weight: 700;
    color: var(--dark-color);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-card p {
    font-size: clamp(0.8rem, 1.5vw, 0.85rem);
    margin-bottom: 0.5rem;
    color: var(--text-color);
    line-height: 1.3;
}

.job-card a {
    color: inherit;
    text-decoration: none;
    display: block;
}

/* Meta Row in Job Card */
.job-meta-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 12px;
    font-size: clamp(0.85rem, 1.5vw, 0.9rem);
    color: #7f8c8d;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== RESPONSIVENESS FOR GRID VIEW ========== */
@media (max-width: 1024px) {
    .job-list {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: clamp(1rem, 1.8vw, 1.5rem);
    }
}

@media (max-width: 768px) {
    .job-list {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        padding: 0 clamp(0.5rem, 1.5vw, 0.75rem);
    }

    .search-container {
        flex-direction: column;
        align-items: stretch;
    }

    #searchInput {
        margin-left: 0;
        margin-top: 10px;
        width: 100% !important;
        max-width: 300px;
        opacity: 1;
        pointer-events: auto;
        display: block;
    }

    #searchToggle {
        display: none;
        /* Hide toggle button under 768px */
    }

}

@media (max-width: 600px) {
    .job-list {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: clamp(0.8rem, 1.5vw, 1.2rem);
    }

    .job-card {
        padding: clamp(12px, 2vw, 15px);
    }
}

@media (max-width: 480px) {
    body {
        padding: clamp(0.5rem, 1.5vw, 0.75rem);
    }

    h1 {
        font-size: clamp(1.4rem, 3vw, 1.5rem);
    }

    .job-list {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: clamp(0.8rem, 1.5vw, 1rem);
    }

    .job-card {
        padding: clamp(10px, 2vw, 12px);
    }

    .job-card h3 {
        font-size: clamp(1rem, 2vw, 1.1rem);
    }

    .job-card p {
        font-size: clamp(0.75rem, 1.5vw, 0.8rem);
    }

    .search-container {
        margin-bottom: clamp(0.8rem, 1.5vw, 1rem);
    }

    .filters {
        flex-direction: column;
        align-items: center;
        gap: clamp(8px, 1.5vw, 10px);
    }
}

@media (max-width: 360px) {
    .job-list {
        grid-template-columns: 1fr;
        /* Single column for very small screens */
        gap: clamp(0.8rem, 1.5vw, 1rem);
    }

    .job-card {
        padding: clamp(10px, 2vw, 12px);
    }

    .job-card h3 {
        font-size: clamp(0.95rem, 2vw, 1.05rem);
    }

    .job-card p {
        font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    }
}

/* Divider */
.divider {
    height: 2px;
    width: 100%;
    background-color: #ccc;
    margin: clamp(1rem, 2vw, 1.5rem) 0;
    border-radius: 1px;
}

/* Button Styles */
.edit-btn,
.delete-btn {
    padding: clamp(6px, 1.5vw, 8px) clamp(10px, 2vw, 12px);
    margin: 0 clamp(4px, 1vw, 5px);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    color: white;
    transition: background-color 0.3s ease;
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
    touch-action: manipulation;
}

.edit-btn {
    background-color: var(--secondary-color);
}

.edit-btn:hover {
    background-color: var(--secondary-color-dark);
}

.delete-btn {
    background-color: var(--redAlert-color);
}

.delete-btn:hover {
    background-color: var(--redAlert-color-dark);
}

/* Additional Breakpoint for Larger Screens */
@media (min-width: 1440px) {
    .job-list {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        max-width: 1400px;
    }
}