/* ========================================
   Job Listing Styles
   Route: /post (PostsController::index)
   Based on jobprimer.html template
   ======================================== */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

body {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Layout & Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.jbpr-joblist {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

@media (min-width: 900px) {
    .container,
    .jbpr-joblist {
        flex-direction: row;
        gap: 30px;
        padding: 20px;
        align-items: flex-start;
    }
}

/* Search Panel */
.search-panel {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    padding: 15px;
    box-sizing: border-box;
}

.searchpage_box {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    padding: 15px;
    box-sizing: border-box;
}

.searchpage_box.fixed_searchpage_box {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    border-radius: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

@media (min-width: 900px) {
    .search-panel,
    .searchpage_box {
        width: 400px;
        background-color: #ffffff;
        border: none;
        border-right: 1px solid #eee;
        border-radius: 0;
        padding: 0 15px 0 0;
        margin-bottom: 0;
        flex-shrink: 0;
        position: sticky;
        top: 20px;
        align-self: flex-start;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    /* Hide scrollbar for search panel while keeping functionality */
    .search-panel::-webkit-scrollbar,
    .searchpage_box::-webkit-scrollbar {
        width: 0px;
        background: transparent;
    }
    
    .search-panel,
    .searchpage_box {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }
}

.search_text h4,
.search-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 10px;
    color: #333;
    border-bottom: 2px solid #007bff;
    letter-spacing: 0.5px;
}

.search-field,
.job_search select {
    width: 100%;
    height: 38px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 10px;
    font-size: 14px;
    background-color: #fff;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.search-field:focus,
.job_search select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.search-field:hover,
.job_search select:hover {
    border-color: #007bff;
}

.posts_view {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.posts_view > .job_search {
    margin-bottom: 8px;
}

.job_search {
    width: 100%;
    margin-bottom: 0;
}

.job_search--location-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.job_search--location-group > select:first-child {
    flex: 1;
}

.detailed-search,
#advance-search {
    font-size: 12px;
    color: #007bff;
    text-decoration: none;
    margin-bottom: 10px;
    margin-top: 4px;
    display: inline-block;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.detailed-search:hover,
#advance-search:hover {
    color: #0056b3;
    text-decoration: underline;
}

#additionalSearch {
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid #e9ecef;
}

.search-button,
.job_search_submit button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

.search-button:hover,
.job_search_submit button:hover {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.search-button:active,
.job_search_submit button:active {
    transform: translateY(0);
}

/* Job Listings Container */
.job-listings {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.joblist_container {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

@media (min-width: 900px) {
    .job-listings,
    .joblist_container {
        flex: 1;
        padding: 0;
        padding-right: 10px;
        min-height: 100vh;
    }
}

/* Job Cards */
.job-card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

/* Alternating background for job listings (desktop & mobile) */
.job-listings > .job-card:nth-child(even),
.job-listings > .free-job-card:nth-child(even) {
    background-color: #f7f8fa;
}

.job-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
    border-color: #0056b3;
}

/* Premium Job Cards - Subtle Highlight */
.job-card--premium {
    background: linear-gradient(to bottom, rgba(128, 128, 128, 0.02) 0%, #ffffff 100%);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.job-card--premium:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.18);
    transform: translateY(-3px);
}

.job-card--premium.job-card--direct {
    background: linear-gradient(to bottom, rgba(128, 128, 128, 0.02) 0%, #ffffff 100%) !important;
}

.job-card--premium.job-card--agency {
    background: linear-gradient(to bottom, rgba(128, 128, 128, 0.02) 0%, #ffffff 100%);
}

.apply-tag.apply-tag--direct {
    background-color: #007bff !important;
}

.apply-tag.apply-tag--agency {
    background-color: #007bff !important;
}

.job-card-upper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.job-card-lower {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.job-basic-info {
    flex: 1;
}

.job-details-section {
    flex: 1;
}

.company-name {
    color: #007bff;
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 5px 0;
}

.job-title {
    color: #007bff;
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 8px 0;
}

.job-description {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.apply-tag {
    background-color: #1e7e34;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.favorite-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.favorite-star {
    width: 24px;
    height: 24px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    display: inline-block;
    flex-shrink: 0;
}

.favorite-star:hover {
    transform: scale(1.2);
}

.favorite-star svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.favorite-star:not(.active) svg {
    fill: none;
    stroke: #ccc;
    stroke-width: 2;
}

.favorite-star.active svg {
    fill: #ffc107;
    stroke: #ffb300;
    stroke-width: 1;
    filter: drop-shadow(0 2px 4px rgba(255, 193, 7, 0.3));
}

.job-tags {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tag {
    background-color: transparent;
    color: #333;
    border: 1px solid #333;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
    white-space: nowrap;
    width: fit-content;
}

.job-detail {
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.detail-label {
    background-color: #0056b3;
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
    width: 60px;
    text-align: center;
}

.detail-value {
    font-size: 13px;
    color: #333;
}

.job-image {
    width: 300px;
    height: 300px;
    flex-shrink: 0;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    border: 2px dashed #ccc;
    border-radius: 6px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

.job-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* Free Job Cards */
.free-job-card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.free-job-card:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
    border-color: #0056b3;
}

.free-job-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.free-job-title {
    color: #007bff;
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 5px 0;
}

.free-job-company {
    color: #333;
    font-size: 14px;
    margin: 0 0 5px 0;
}

.free-job-location {
    color: #666;
    font-size: 13px;
    margin: 0 0 5px 0;
}

.free-job-salary {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.free-salary-label {
    background-color: #0056b3;
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    width: 60px;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.free-salary-value {
    font-size: 13px;
    color: #333;
    font-weight: bold;
}

/* Additional Search */
#additionalSearch {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Search Form Enhancements */
.search__radio-wrapper,
.search__checkbox-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    margin: 0 0 3px 0;
    cursor: pointer;
    padding: 5px 4px;
    border-radius: 3px;
    background-color: transparent;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.search__radio-wrapper:last-child,
.search__checkbox-wrapper:last-child {
    margin-bottom: 0;
}

.search__radio-wrapper:hover,
.search__checkbox-wrapper:hover {
    background-color: #f0f7ff;
}

.search__radio-wrapper input:checked,
.search__checkbox-wrapper input:checked {
    accent-color: #007bff;
}

.search__radio-wrapper:has(input:checked) .search__text,
.search__checkbox-wrapper:has(input:checked) .search__text {
    font-weight: 500;
}

.search__radio-wrapper input,
.search__checkbox-wrapper input {
    margin-right: 14px !important;
    margin-top: 2px !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #007bff;
    flex-shrink: 0;
}

.search__text {
    font-size: 13px;
    color: #333;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    direction: ltr;
}

@media (min-width: 1050px) {
    .search__text {
        word-break: keep-all;
        overflow-wrap: normal;
    }
}

.job_search {
    margin-bottom: 0;
}

.search-group {
    background-color: transparent;
    padding: 6px 0 4px 0;
    margin-bottom: 8px;
}

.search-group-label {
    font-size: 11px;
    font-weight: 600;
    color: #007bff;
    margin-bottom: 4px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* NEW badge */
.new_container {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #ff5722;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

.new-text {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 767px) {
    /* Prevent horizontal overflow on mobile */
    body {
        overflow-x: hidden;
    }
    
    /* Search Panel Mobile */
    .search-panel,
    .searchpage_box {
        padding: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .posts_view {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0;
        margin: 0;
    }
    
    .search-title {
        font-size: 15px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .search-field,
    .job_search select {
        height: 42px;
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .posts_view > .job_search {
        margin-bottom: 10px;
    }
    
    .job_search {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    /* Radio and Checkbox Mobile */
    .search__radio-wrapper,
    .search__checkbox-wrapper {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start;
        padding: 10px 4px;
        margin-bottom: 8px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
        flex-wrap: nowrap !important;
        overflow: hidden;
    }
    
    .search__radio-wrapper input,
    .search__checkbox-wrapper input {
        width: 20px;
        height: 20px;
        margin-right: 10px !important;
        margin-top: 2px !important;
        margin-bottom: 0 !important;
        margin-left: 0 !important;
        flex-shrink: 0;
    }
    
    /* Override global mobile rule that forces .search__checkbox to width:100% */
    .search__checkbox-wrapper .search__checkbox {
        width: auto !important;
        display: inline-block;
    }
    
    .search__text {
        font-size: 14px;
        line-height: 1.6;
        flex: 1 1 0%;
        min-width: 0;
        max-width: calc(100% - 30px);
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        white-space: normal;
        overflow: hidden;
    }
    
    .search-group {
        padding: 10px 0;
        margin-bottom: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .job_search.search-group {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .search__checkbox-wrapper {
        min-width: 0;
        overflow: hidden;
    }
    
    .search__text {
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }
    
    .search-group-label {
        font-size: 13px;
        margin-bottom: 8px;
        display: block;
        font-weight: 700;
    }
    
    .search-button {
        height: 44px;
        font-size: 15px;
        margin-top: 12px;
    }
    
    #advance-search {
        padding: 8px 0;
        margin: 8px 0;
        font-size: 13px;
    }
    
    #additionalSearch {
        padding-top: 10px;
        margin-top: 10px;
    }
    
    /* Job Cards Mobile */
    .job-image {
        width: 100%;
        height: 250px;
    }
    
    .job-card {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .job-card-upper {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .job-card-lower {
        flex-direction: column;
        gap: 15px;
    }
    
    .free-job-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 12px;
    }
    
    .free-job-info {
        flex: 1;
        padding-right: 10px;
    }
    
    .company-name,
    .job-title,
    .free-job-title {
        font-size: 15px;
    }
    
    .favorite-star {
        width: 28px;
        height: 28px;
    }
    
    .apply-tag {
        font-size: 11px;
        padding: 6px 12px;
    }
}

/* Legacy support for existing classes */
.job-list__container {
    position: relative;
}

.job-list__button-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.job-list__button {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.job-list__button--orange {
    background-color: #ff9800;
    color: #fff;
}

.job-list__button--orange:hover {
    background-color: #f57c00;
}

.job-list__button--green {
    background-color: #4CA89F;
    color: #fff;
}

.job-list__button--green:hover {
    background-color: #3a8a82;
}

.read-more {
    background-color: #2196F3;
    color: #fff;
}

.read-more:hover {
    background-color: #1976D2;
}
