/* TalentEdge Job Search - Frontend Styles */

/* Variables - matching TalentEdge theme */
.teg-job-search {
    --teg-primary: #ff4a6f;
    --teg-primary-dark: #c3234c;
    --teg-secondary: #0ea99f;
    --teg-secondary-dark: #0b7d7a;
    --teg-emerald: #003034;
    --teg-emerald-dark: #002c30;
    --teg-emerald-light: #0e5053;
    --teg-text-dark: #003034;
    --teg-white: #ffffff;
    --teg-gray-light: #f5f5f5;
    --teg-gray: #e5e7eb;
    --teg-radius: 0.5rem;
    --teg-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    font-family: 'Poppins', sans-serif;
    color: var(--teg-text-dark);
    line-height: 1.6;
}

@media (max-width: 900px) {
    .teg-job-search {
        grid-template-columns: 1fr;
    }
}

/* Filters Sidebar */
.teg-filters {
    background: var(--teg-white);
    border-radius: var(--teg-radius);
    padding: 2rem;
    box-shadow: var(--teg-shadow);
    height: fit-content;
    position: sticky;
    top: 7rem;
}

@media (max-width: 900px) {
    .teg-filters {
        position: static;
    }
}

.teg-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--teg-gray);
}

.teg-filters-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--teg-emerald) !important;
}

.teg-clear-filters {
    background: none;
    border: none;
    color: var(--teg-primary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0;
    transition: color 0.2s;
}

.teg-clear-filters:hover {
    color: var(--teg-primary-dark);
}

.teg-filter-group {
    margin-bottom: 1.25rem;
}

.teg-filter-group > label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--teg-emerald);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.teg-search-input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--teg-gray);
    border-radius: var(--teg-radius);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.teg-search-input:focus {
    outline: none;
    border-color: var(--teg-secondary);
    box-shadow: 0 0 0 3px rgba(14, 169, 159, 0.1);
}

.teg-filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 180px;
    overflow-y: auto;
}

.teg-filter-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    padding: 0.2rem 0;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.teg-filter-option:hover {
    background: var(--teg-gray-light);
}

.teg-filter-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--teg-secondary);
    cursor: pointer;
    flex-shrink: 0;
}

.teg-filter-option span {
    font-size: 0.85rem;
    color: var(--teg-text-dark) !important;
}

.teg-filter-option span.teg-filter-count {
    font-size: 0.55rem;
    color: #ffffff !important;
    background: var(--teg-primary);
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    font-weight: 700;
    line-height: 1;
}

.teg-loading-filters {
    color: #666;
    font-size: 0.875rem;
    padding: 0.5rem;
}

/* Job Listings */
.teg-job-listings {
    min-height: 500px;
}

.teg-listings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--teg-radius);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.teg-results-count {
    font-size: 1.1rem;
    color: white;
    font-weight: 500;
}

.teg-results-count span {
    font-weight: 700;
    color: var(--teg-primary);
    font-size: 1.3rem;
}

.teg-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.teg-sort label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.teg-sort select {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--teg-radius);
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    font-family: inherit;
    color: var(--teg-emerald);
}

/* Jobs Grid */
.teg-jobs-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Job Card */
.teg-job-card {
    background: var(--teg-white);
    border-radius: var(--teg-radius);
    padding: 1.5rem;
    box-shadow: var(--teg-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border-left: 4px solid transparent;
}

.teg-job-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-left-color: var(--teg-primary);
}

.teg-job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.teg-job-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--teg-emerald) !important;
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
}

.teg-job-company {
    font-size: 0.95rem;
    color: var(--teg-secondary) !important;
    font-weight: 500;
}

.teg-job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.teg-job-meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    color: #666 !important;
}

.teg-job-meta-item svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
}

.teg-job-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.teg-job-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--teg-gray-light);
    color: var(--teg-emerald) !important;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.teg-job-tag.teg-tag-primary {
    background: rgba(255, 74, 111, 0.1);
    color: var(--teg-primary) !important;
}

.teg-job-tag.teg-tag-secondary {
    background: rgba(14, 169, 159, 0.1);
    color: var(--teg-secondary) !important;
}

.teg-job-salary {
    font-weight: 600;
    color: var(--teg-secondary) !important;
    font-size: 0.95rem;
}

/* Loading State */
.teg-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
}

.teg-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--teg-gray);
    border-top-color: var(--teg-primary);
    border-radius: 50%;
    animation: teg-spin 0.8s linear infinite;
}

@keyframes teg-spin {
    to { transform: rotate(360deg); }
}

/* No Results */
.teg-no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.teg-no-results h3 {
    margin-bottom: 0.5rem;
    color: var(--teg-emerald);
}

/* Pagination */
.teg-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.teg-pagination button {
    padding: 0.5rem 1rem;
    border: 2px solid var(--teg-gray);
    background: var(--teg-white);
    border-radius: var(--teg-radius);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
}

.teg-pagination button:hover:not(:disabled) {
    border-color: var(--teg-secondary);
    color: var(--teg-secondary);
}

.teg-pagination button.active {
    background: var(--teg-primary);
    border-color: var(--teg-primary);
    color: var(--teg-white);
}

.teg-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.teg-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.teg-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.teg-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 48, 52, 0.8);
    backdrop-filter: blur(4px);
}

.teg-modal-content {
    position: relative;
    background: var(--teg-white);
    border-radius: var(--teg-radius);
    max-width: 800px;
    max-height: 90vh;
    width: 90%;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: teg-modal-in 0.3s ease-out;
}

@keyframes teg-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.teg-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--teg-gray-light);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 10;
}

.teg-modal-close:hover {
    background: var(--teg-gray);
}

.teg-modal-body {
    padding: 2rem;
}

/* Job Detail in Modal */
.teg-job-detail-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--teg-gray);
}

.teg-job-detail-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--teg-emerald);
    margin: 0 0 0.5rem 0;
}

.teg-job-detail-company {
    font-size: 1.1rem;
    color: var(--teg-secondary);
    font-weight: 500;
    margin-bottom: 1rem;
}

.teg-job-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1rem;
}

.teg-job-detail-section {
    margin-bottom: 2rem;
}

.teg-job-detail-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--teg-emerald);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--teg-gray-light);
}

.teg-job-detail-section ul {
    margin: 0;
    padding-left: 1.5rem;
}

.teg-job-detail-section li {
    margin-bottom: 0.5rem;
}

.teg-apply-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--teg-primary);
    color: var(--teg-white);
    border: none;
    border-radius: var(--teg-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    font-family: inherit;
}

.teg-apply-button:hover {
    background: var(--teg-primary-dark);
    color: var(--teg-white);
}

/* Apply Modal (iframe) */
.teg-apply-modal-content {
    max-width: 900px;
    height: 90vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.teg-apply-modal-content .teg-modal-close {
    background: var(--teg-white);
    box-shadow: var(--teg-shadow);
}

#teg-apply-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--teg-radius);
}

/* Responsive */
@media (max-width: 600px) {
    .teg-job-card {
        padding: 1rem;
    }
    
    .teg-job-card-header {
        flex-direction: column;
    }
    
    .teg-job-meta {
        gap: 0.5rem;
    }
    
    .teg-listings-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .teg-modal-body {
        padding: 1.5rem;
    }
    
    .teg-job-detail-meta {
        gap: 1rem;
    }
}

/* ===================================
   Job Detail Page Styles
   =================================== */

/* Detail page layout - full width */
.teg-job-search[data-view="detail"] {
    display: block;
    width: 100% !important;
    max-width: none !important;
    grid-template-columns: none;
}

/* Hide page title block when viewing single job */
.teg-job-search[data-view="detail"] ~ .page-title-block,
body:has(.teg-job-search[data-view="detail"]) .page-title-block {
    display: none !important;
}

/* Back link */
.teg-job-detail-nav {
    margin-bottom: 2rem;
}

.teg-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--teg-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.teg-back-link:hover {
    color: var(--teg-secondary-dark);
}

.teg-back-link svg {
    width: 20px;
    height: 20px;
}

/* Job not found */
.teg-job-not-found {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--teg-white);
    border-radius: var(--teg-radius);
    box-shadow: var(--teg-shadow);
}

.teg-job-not-found h2 {
    color: var(--teg-emerald);
    margin-bottom: 1rem;
}

.teg-job-not-found p {
    color: var(--teg-text-dark);
    margin-bottom: 2rem;
}

/* Detail wrapper - two column */
.teg-job-detail-wrapper {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .teg-job-detail-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Main content */
.teg-job-detail-main {
    background: var(--teg-white);
    border-radius: var(--teg-radius);
    box-shadow: var(--teg-shadow);
    padding: 2rem;
}

.teg-job-detail-header {
    border-bottom: 2px solid var(--teg-gray);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.teg-job-detail-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--teg-emerald) !important;
    margin: 0 0 1rem 0;
    line-height: 1.2;
}

.teg-job-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.teg-job-detail-meta .teg-job-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--teg-text-dark) !important;
    font-size: 0.95rem;
}

.teg-job-detail-meta .teg-job-meta-item svg {
    width: 18px;
    height: 18px;
    color: var(--teg-secondary);
    flex-shrink: 0;
}

.teg-job-detail-section {
    margin-bottom: 2rem;
}

.teg-job-detail-section:last-child {
    margin-bottom: 0;
}

.teg-job-detail-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--teg-emerald) !important;
    margin: 0 0 1rem 0;
}

.teg-job-description {
    color: var(--teg-text-dark) !important;
    line-height: 1.8;
}

.teg-job-description p {
    margin-bottom: 1rem;
}

.teg-job-description ul,
.teg-job-description ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.teg-job-description li {
    margin-bottom: 0.5rem;
}

.teg-job-description h3,
.teg-job-description h4 {
    color: var(--teg-emerald) !important;
    margin: 1.5rem 0 0.75rem;
}

/* Sidebar */
.teg-job-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .teg-job-detail-sidebar {
        order: -1;
    }
}

/* Apply Card */
.teg-job-apply-card {
    background: var(--teg-secondary-dark);
    border-radius: var(--teg-radius);
    padding: 2rem;
    text-align: center;
    color: var(--teg-white);
}

.teg-job-apply-card h3 {
    font-size: 1.25rem;
    margin: 0 0 1.5rem 0;
    font-weight: 600;
    color: var(--teg-white) !important;
}

.teg-job-salary-display {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--teg-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.teg-salary-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.teg-salary-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
}

.teg-job-apply-card .teg-apply-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--teg-primary);
    color: var(--teg-white) !important;
    border: none;
    border-radius: var(--teg-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.teg-job-apply-card .teg-apply-button:hover {
    background: var(--teg-primary-dark);
    transform: translateY(-2px);
    color: var(--teg-white) !important;
}

.teg-job-apply-card .teg-apply-button svg {
    width: 20px;
    height: 20px;
}

.teg-apply-note {
    font-size: 0.85rem;
    opacity: 0.8;
    margin: 1rem 0 0 0;
}

/* Summary Card */
.teg-job-summary-card {
    background: var(--teg-white);
    border-radius: var(--teg-radius);
    padding: 1.5rem;
    box-shadow: var(--teg-shadow);
}

.teg-job-summary-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--teg-emerald) !important;
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--teg-gray);
}

.teg-job-summary-list {
    margin: 0;
}

.teg-summary-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--teg-gray-light);
}

.teg-summary-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.teg-summary-item dt {
    font-size: 0.85rem;
    color: #666 !important;
    margin-bottom: 0.25rem;
}

.teg-summary-item dd {
    font-weight: 500;
    color: var(--teg-text-dark) !important;
    margin: 0;
}

/* Share Card */
.teg-job-share-card {
    background: var(--teg-white);
    border-radius: var(--teg-radius);
    padding: 1.5rem;
    box-shadow: var(--teg-shadow);
}

.teg-job-share-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--teg-emerald) !important;
    margin: 0 0 1rem 0;
}

.teg-share-buttons {
    display: flex;
    gap: 0.75rem;
}

.teg-share-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--teg-radius);
    background: var(--teg-gray-light);
    color: var(--teg-emerald) !important;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.teg-share-button svg {
    width: 20px;
    height: 20px;
    color: var(--teg-emerald) !important;
}

.teg-share-button:hover {
    transform: translateY(-2px);
    background: var(--teg-emerald);
    color: white !important;
}

.teg-share-button:hover svg {
    color: white !important;
}

.teg-share-copy.copied {
    background: #10b981;
    color: white !important;
}

.teg-share-copy.copied svg {
    color: white !important;
}

/* Job cards as links */
a.teg-job-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

a.teg-job-card:hover {
    text-decoration: none;
}

/* Responsive detail page */
@media (max-width: 600px) {
    .teg-job-detail-main {
        padding: 1.5rem;
    }
    
    .teg-job-detail-title {
        font-size: 1.5rem;
    }
    
    .teg-job-detail-meta {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .teg-job-apply-card {
        padding: 1.5rem;
    }
}
