/* --- AI Auto Job Engine Archive Styles (v6.2.1 - Mobile & AdSense Optimized) --- */

/* --- GLOBAL RESET & ADSENSE FIX (Added for Centering & Scroll Safety) --- */
/* This ensures padding/borders don't expand width, and Ads stay inside */
.aaje-job-archive-container,
.aaje-job-archive-container *,
.aaje-recent-jobs-widget,
.aaje-recent-jobs-widget * {
    box-sizing: border-box;
}

/* Force Google Ads (ins/iframe) to respect container width */
/* This keeps the layout centered even if an Ad tries to be wide */
.aaje-job-archive-container img,
.aaje-job-archive-container iframe,
.aaje-job-archive-container ins,
.aaje-job-archive-container video,
.aaje-recent-jobs-widget iframe,
.aaje-recent-jobs-widget ins {
    max-width: 100% !important;
    width: auto;
    box-sizing: border-box !important;
}

/* --- Main Container (Updated for Centering) --- */
.aaje-job-archive-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 900px;
    width: 100%;          /* Forces container to fit parent, preventing shift */
    margin: 2rem auto;    /* 'auto' forces it to the center */
    padding: 0 15px;      /* Adds safe zone so edges don't touch screen */
    overflow-x: clip;     /* Prevents horizontal scroll without cutting off tooltips */
}

/* --- Modern Filter Bar (Updated for Responsiveness) --- */
.aaje-filters-bar {
    display: flex;       /* Changed from Grid to Flex for better wrapping */
    flex-wrap: wrap;     /* Allow items to drop to new lines */
    gap: 1rem;
    align-items: center;
    margin-bottom: 2.5rem;
    background-color: #f8f9fa;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box; /* Ensures padding doesn't widen the container */
}

/* Make inputs flexible but robust (UPDATED) */
.aaje-filters-bar input[type="text"],
.aaje-filters-bar select {
    flex: 1 1 210px;  /* Flexible width base */
    min-width: 210px; /* STRICT minimum width so text is not cut off */
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    height: 48px;
}

/* Ensure the button doesn't shrink weirdly */
.aaje-filters-bar button {
    flex: 0 0 auto; /* Don't grow or shrink, just stay button-sized */
    min-width: 120px;
    background-color: #0084B4;
    color: #ffffff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    height: 48px;
}

.aaje-filters-bar select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em;
    color: #6b7280;
}
.aaje-filters-bar select option { color: #111827; }

.aaje-filters-bar input[type="text"]:focus,
.aaje-filters-bar select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.2);
}

.aaje-filters-bar button:hover { background-color: #007399; }

/* --- Job List --- */
.aaje-job-list { display: grid; gap: 1.5rem; }

/* --- Individual Job Card --- */
.aaje-job-card {
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.aaje-job-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.07), 0 4px 6px -4px rgb(0 0 0 / 0.07);
}

.aaje-job-card-logo {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
}

.aaje-job-card-details { flex-grow: 1; }
.aaje-job-card-details h3 { margin: 0 0 0.25rem; font-size: 1.2rem; font-weight: 600; }
.aaje-job-card-details h3 a { text-decoration: none; color: #111827; transition: color 0.2s ease; }
.aaje-job-card-details h3 a:hover { color: #0084B4; }

.aaje-job-card-company { font-weight: 500; margin-bottom: 0.75rem; display: block; }
a.aaje-job-card-company {
    color: #374151;
    text-decoration: none !important;
    transition: color 0.2s ease;
}
a.aaje-job-card-company:hover { color: #0084B4; }
span.aaje-job-card-company { color: #374151; }

.aaje-job-card-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.9rem; color: #6b7280; }
.aaje-job-card-meta span { display: inline-flex; align-items: center; gap: 0.35rem; }

.aaje-job-card-actions {
    display: flex;
    flex-direction: row; /* This aligns items horizontally */
    align-items: center;  /* This vertically centers the tags and the button */
    gap: 1rem;            /* This adds a nice space between the tags and the button */
    flex-shrink: 0;
}
.aaje-job-card-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }

/* Styling for the original job type tag */
.aaje-job-card-tag {
    background-color: #f3f4f6; /* A light grey */
    color: #374151; /* A dark grey text */
    padding: 0.25rem 0.75rem; 
    border-radius: 9999px; 
    font-size: 0.8rem; 
    font-weight: 500;
}

/* Styling for the new Work Model tag */
.aaje-job-card-tag.work-model-tag {
    background-color: #e0f2fe; /* A light sky blue */
    color: #0c4a6e; /* A dark blue text */
}

.aaje-job-card-view-btn {
    background-color: #ef4444; color: #ffffff !important; text-decoration: none !important;
    padding: 0.5rem 1.25rem; border-radius: 8px; font-weight: 600;
    transition: background-color 0.2s ease; margin-top: 0.5rem;
    text-align: center; white-space: nowrap;
}
.aaje-job-card-view-btn:hover { background-color: #dc2626; }

.aaje-no-jobs { background-color: #fff; padding: 2rem; border-radius: 12px; text-align: center; color: #4b5563; border: 1px solid #e5e7eb; }

/* --- Load More Button Styles --- */
.aaje-load-more-wrapper { text-align: center; margin-top: 2.5rem; }
.aaje-load-more-btn {
    background-color: #0084B4;
    color: #ffffff;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}
.aaje-load-more-btn:hover { background-color: #007399; }
.aaje-load-more-btn:disabled { background-color: #9ca3af; cursor: wait; }

/* --- Mobile Responsive Fixes (Updated for Ad Safety) --- */
@media (max-width: 900px) {
    /* Stack the filter bar vertically on tablets & phones */
    .aaje-filters-bar {
        flex-direction: column;
        align-items: stretch; /* Stretch inputs to full width */
        gap: 0.75rem;
        padding: 1rem;
    }

    .aaje-filters-bar input[type="text"],
    .aaje-filters-bar select,
    .aaje-filters-bar button {
        width: 100% !important;      /* Force full width */
        min-width: 0 !important;     /* SAFETY: Ignore the desktop 210px limit on phones */
        flex: auto;
        margin: 0;
    }

    /* Existing Job Card Fixes */
    .aaje-job-archive-container {
        padding: 0 1rem;
        margin-top: 1rem;
        width: 100%; /* Ensure container fits screen */
    }
    .aaje-job-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .aaje-job-card-actions {
        width: 100%;
        flex-direction: row; 
        justify-content: space-between; /* Space out button and tags */
        margin-top: 1rem;
    }
    .aaje-job-card-view-btn {
        width: auto; /* Allow button to be natural width or 100% depending on preference */
        flex-grow: 1; /* Make button fill remaining space */
    }
}

/* --- Tiny Screen Fixes (iPhone 4/SE/Small Androids) --- */
@media (max-width: 400px) {
    .aaje-filters-bar {
        padding: 0.75rem; /* Reduce padding to save space */
        background-color: transparent; /* Cleaner look on tiny screens */
        border: none;
    }
    
    .aaje-filters-bar input[type="text"],
    .aaje-filters-bar select,
    .aaje-filters-bar button {
        height: 44px;    /* Slightly smaller touch targets */
        font-size: 14px; /* Prevent text cutting off */
    }

    /* Stack the job card actions on very small screens */
    .aaje-job-card-actions {
        flex-direction: column; 
        align-items: stretch;
    }
    .aaje-job-card-tags {
        justify-content: flex-start;
    }
}


/* --- CORRECTED: Recent Jobs Sidebar Shortcode Styles --- */
.aaje-recent-jobs-widget {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    /* Ad Safety */
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.aaje-recent-jobs-widget .aaje-recent-jobs-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    color: #111827;
}

.aaje-recent-jobs-widget .aaje-recent-jobs-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.aaje-recent-jobs-widget .aaje-recent-job-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    padding: 0.75rem;
    border-radius: 8px;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: 1px solid transparent;
}

.aaje-recent-jobs-widget .aaje-recent-job-item a:hover {
    background-color: #ffffff;
    transform: translateY(-2px);
    border-color: #e5e7eb;
    box-shadow: 0 4px 10px rgb(0 0 0 / 0.07);
}

.aaje-recent-jobs-widget .aaje-recent-job-logo {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
}

.aaje-recent-jobs-widget .aaje-recent-job-details {
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

/* ## THIS IS THE SECTION THAT WAS CHANGED ## */
.aaje-recent-jobs-widget .aaje-recent-job-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    white-space: normal; /* <-- FIX: Changed from nowrap to normal */
    transition: color 0.2s ease-in-out;
}

.aaje-recent-jobs-widget .aaje-recent-job-item a:hover .aaje-recent-job-title {
    color: #0084B4;
}

.aaje-recent-jobs-widget .aaje-recent-job-meta {
    font-size: 0.875rem;
    color: #6b7280;
    /* Also allow the meta text to wrap if needed */
    white-space: normal; 
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}


/* --- Tweak to reset widget styles on archive pages --- */
.archive .aaje-recent-jobs-widget {
    border: none;
    box-shadow: none;
    padding: 0;
    background-color: transparent;
}