/**
 * Job Cards Modal System - Collapsed view with modal popup
 */

/* ==========================================================================
   COLLAPSED JOB CARD STYLES
   ========================================================================== */

.job-card.collapsed {
    height: auto;
    max-height: 320px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.3s ease;
    padding-bottom: 5.2rem;
}

.job-card.collapsed::after {
    content: '';
    position: absolute;
    bottom: 3.8rem;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--color-content-bg) 70%);
    pointer-events: none;
}

.job-card.collapsed .job-description-collapsed {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    max-height: 4.8em; /* 3 lines * 1.6 line-height */
    overflow: hidden;
    position: relative;
}

.job-card.collapsed .job-description-collapsed::after {
    content: '...';
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--color-content-bg);
    padding-left: 5px;
}

.job-card.collapsed .job-section {
    display: none;
}

.job-card.collapsed .job-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0;
    padding: 0.9rem 0 0.6rem;
    border-top: 1px solid var(--color-border);
    position: relative;
    z-index: 2;
    position: absolute;
    left: var(--layout-card-padding, 2rem);
    right: var(--layout-card-padding, 2rem);
    bottom: 0.5rem;
    background: var(--color-content-bg);
}

/* Job Meta Compact */
.job-meta-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--color-text);
}

.job-meta-compact span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--color-bg-light);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
}

/* Badges Compact */
.job-badges-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.badge-compact {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-contract-compact {
    background: var(--color-primary);
    color: white;
}

.badge-level-compact {
    background: var(--color-info);
    color: white;
}

/* Show More Button */
.btn-show-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #155a8a;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    margin-bottom: 0.5rem;
    white-space: nowrap;
}

.btn-show-more:hover {
    background: #0f4a72;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.btn-show-more:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-show-more i {
    font-size: 0.9em;
    transition: transform 0.2s;
}

.btn-show-more:hover i {
    transform: translateX(2px);
}

/* ==========================================================================
   MODAL STYLES
   ========================================================================== */

.job-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.job-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.job-modal {
    background: var(--color-content-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.job-modal-banner {
    position: relative;
    aspect-ratio: 16 / 5;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(11, 27, 42, 0.12), rgba(11, 27, 42, 0.72)),
        radial-gradient(circle at top right, rgba(151, 191, 85, 0.7), transparent 40%),
        linear-gradient(135deg, #12314a 0%, #1b5f8d 55%, #97bf55 100%);
}

.job-modal-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 18, 29, 0.08) 0%, rgba(8, 18, 29, 0.74) 100%);
}

.job-modal-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.job-modal-banner-copy {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.2rem 1.5rem 1.35rem;
    color: #fff;
    z-index: 1;
}

.job-modal-banner-title {
    margin: 0;
    font-size: 1.6rem;
    line-height: 1.1;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.job-modal-banner-company {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.job-modal-overlay.active .job-modal {
    transform: translateY(0);
    opacity: 1;
}

.job-modal-header {
    padding: 0.35rem 1.5rem 0;
    position: sticky;
    top: 0;
    background: transparent;
    z-index: 10;
    border-bottom: none;
}

.job-modal-title {
    display: none;
}

.job-modal-company {
    display: none;
}

.job-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-light);
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.job-modal-close:hover {
    background: var(--color-bg-light);
    color: var(--color-text-dark);
}

.job-modal-content {
    padding: 1.5rem;
}

.job-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.job-modal-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--color-text);
}

.job-modal-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

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

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

.job-modal-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text-dark);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
}

.job-modal-section p {
    line-height: 1.7;
    color: var(--color-text);
    margin: 0 0 1rem 0;
}

.job-modal-section ul,
.job-modal-section ol {
    margin: 0 0 1rem 1.5rem;
    padding: 0;
    color: var(--color-text);
}

.job-modal-section li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.job-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--color-bg-light);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.btn-apply {
    background: var(--color-success);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.btn-apply:hover {
    background: var(--color-success-dark);
    transform: translateY(-1px);
}

.btn-apply:active {
    transform: translateY(0);
}

.btn-close-modal {
    background: var(--color-bg-light);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-close-modal:hover {
    background: var(--color-border);
    border-color: var(--color-text-light);
}

/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 768px) {
    .job-card.collapsed {
        max-height: 300px;
        padding-bottom: 4.9rem;
    }
    
    .job-modal {
        max-width: 95%;
        max-height: 85vh;
    }
    
    .job-modal-header {
        padding: 1rem 1rem 0.75rem;
    }
    
    .job-modal-title {
        font-size: 1.3rem;
        padding-right: 2rem;
    }
    
    .job-modal-company {
        font-size: 1rem;
    }
    
    .job-modal-content {
        padding: 1rem;
    }
    
    .job-modal-meta {
        gap: 0.75rem;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }
    
    .job-modal-meta span {
        font-size: 0.9rem;
    }
    
    .job-modal-section {
        margin-bottom: 1.5rem;
    }
    
    .job-modal-section h3 {
        font-size: 1.1rem;
    }
    
    .job-modal-footer {
        padding: 1rem;
        flex-direction: column;
    }
    
    .job-modal-footer button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .job-card.collapsed {
        max-height: 280px;
        padding-bottom: 4.7rem;
    }
    
    .job-meta-compact {
        gap: 0.5rem;
        font-size: 0.85rem;
    }
    
    .job-meta-compact span {
        padding: 0.2rem 0.5rem;
    }
    
    .badge-compact {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    
    .btn-show-more {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        white-space: nowrap;
    }
    
    .job-modal {
        max-width: 100%;
        max-height: 90vh;
        border-radius: var(--radius-md);
    }
    
    .job-modal-title {
        font-size: 1.2rem;
    }
    
    .job-modal-company {
        font-size: 0.95rem;
    }
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        transform: translateY(20px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.job-modal-overlay {
    animation: fadeIn 0.3s ease;
}

.job-modal {
    animation: slideUp 0.3s ease;
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.job-modal:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.job-modal-close:focus,
.btn-show-more:focus,
.btn-apply:focus,
.btn-close-modal:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .job-modal-overlay {
        position: static;
        background: none;
        display: block;
        opacity: 1;
    }
    
    .job-modal {
        box-shadow: none;
        max-height: none;
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .job-modal-close,
    .job-modal-footer {
        display: none;
    }
    
    .job-modal-header {
        position: static;
    }
}
