/* ══════════════════════════════════════════════════
   MODAL POPUP & LOADER STYLING (KKSOFT AEC)
   ══════════════════════════════════════════════════ */

/* ── Modal Overlay ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Modal Container ── */
.modal-container {
    background: var(--bg-card, #111);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    scrollbar-width: thin;
    scrollbar-color: var(--grey) transparent;
}

.modal-overlay.visible .modal-container {
    transform: scale(1) translateY(0);
}

/* ── Close Button ── */
.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--white, #fff);
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--ease), transform var(--ease);
    z-index: 10010;
}

.modal-close-btn:hover {
    background: var(--white, #fff);
    color: var(--bg, #000);
    transform: rotate(90deg);
}

/* ── Content Body ── */
.modal-content-body {
    padding: clamp(1.5rem, 5vw, 3rem);
}

/* Prevent body scrolling when modal is active */
body.modal-open,
html.modal-open {
    overflow: hidden !important;
    height: 100% !important;
}

/* ── Skeleton Loading Grid ── */
.loader-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
}

.loader-skeleton-card {
    background: #151515;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    height: 300px;
    position: relative;
    overflow: hidden;
}

.loader-skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* ── Empty State Error Message ── */
.error-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    background: #0d0d0d;
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 480px;
    margin: 2rem auto;
}

.error-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.error-text {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--grey);
}

/* ── Mobile & Tablet Responsiveness for Modals ── */
@media (max-width: 768px) {
    .modal-container {
        width: 92%;
        max-height: 90vh;
        margin: 5vh auto;
        border-radius: 12px;
    }

    .modal-content-body {
        padding: 1.5rem 1.25rem;
    }

    .modal-close-btn {
        top: 12px;
        right: 12px;
        width: 34px;
        height: 34px;
        font-size: 20px;
    }

    /* Modal content elements */
    .modal-content-body h2 {
        font-size: 1.6rem !important;
        padding-right: 40px; /* Leave space for the close button */
        word-wrap: break-word;
    }

    .modal-content-body h3 {
        font-size: 1.4rem !important;
        word-wrap: break-word;
    }

    .modal-content-body img,
    .modal-content-body .modal-gallery-img,
    .modal-content-body .xfactor-avatar {
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }

    .modal-form-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .job-modal-footer {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .job-modal-footer button,
    .job-modal-footer .card-btn,
    .job-modal-footer .btn {
        width: 100% !important;
        margin: 0 !important;
        display: block !important;
        text-align: center !important;
    }

    .modal-image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
        gap: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    .modal-container {
        width: 95%;
        max-height: 92vh;
        margin: 4vh auto;
    }

    .modal-content-body {
        padding: 1.25rem 1rem;
    }

    .modal-close-btn {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .modal-content-body h2 {
        font-size: 1.4rem !important;
    }

    .modal-content-body h3 {
        font-size: 1.2rem !important;
    }
}
