/* --- SPK Training Page Specific Styles --- */

/* Hero Section Styling */
.training-hero {
    position: relative;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
    background-image: url('https://images.unsplash.com/photo-1552664730-d307ca884978?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1770&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    /* Parallax effect */
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-1);
    opacity: 0.8;
}

.training-hero .hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 0 2rem;
}

.training-hero h1 {
    font-size: clamp(2.8rem, 5vw, 4rem);
    font-weight: 800;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
}

.training-hero p {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
}

/* Masonry Gallery Styling */
.masonry-gallery {
    column-count: 3;
    column-gap: 1.5rem;
}

.masonry-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    transition: transform 0.3s ease;
    break-inside: avoid;
    /* Prevents items from breaking across columns */
}

.masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.masonry-item:hover img {
    transform: scale(1.1);
}

.masonry-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 58, 138, 0.75);
    /* Using primary color with alpha */
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.masonry-item:hover .overlay {
    opacity: 1;
}

.overlay h3 {
    font-size: 1.25rem;
    font-weight: 700;
    transform: translateY(20px);
    transition: transform 0.4s ease 0.1s;
}

.overlay p {
    font-size: 0.9rem;
    font-weight: 300;
    transform: translateY(20px);
    transition: transform 0.4s ease 0.2s;
    margin-bottom: 0;
}

.masonry-item:hover .overlay h3,
.masonry-item:hover .overlay p {
    transform: translateY(0);
}


/* Upcoming Courses Section */
#upcoming-courses {
    background-color: #f8fafc;
    /* A slightly off-white background */
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.course-card {
    background: #ffffff;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-light);
    border: 1px solid #e2e8f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.course-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
}

.course-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.course-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.course-description {
    color: #64748b;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.course-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color);
    color: var(--text-light);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.course-btn:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

/* Modal overlay & container */
.course-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 2rem;
    backdrop-filter: blur(4px);
}

.course-modal {
    width: 100%;
    max-width: 900px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.25);
    overflow: hidden;
    display: flex;
    gap: 0;
    transform: translateY(20px) scale(.98);
    opacity: 0;
    transition: transform .28s cubic-bezier(.2, .9, .2, 1), opacity .22s ease;
}

/* show state */
.course-modal-overlay.show {
    display: flex;
}

.course-modal-overlay.show .course-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* left panel (visual) */
.course-modal-visual {
    flex: 0 0 45%;
    padding: 2rem;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.02));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    flex-direction: column;
    text-align: center;
}

.course-modal-visual .icon {
    font-size: 3.2rem;
    line-height: 1;
}

.course-modal-visual h4 {
    margin: .5rem 0 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-color);
}

/* right panel (content) */
.course-modal-content {
    flex: 1;
    padding: 2rem;
    color: #223;
}

.course-modal-content h3 {
    margin: 0 0 .5rem;
    font-size: 1.25rem;
    font-weight: 800;
}

.course-modal-content p {
    margin: 0 0 1rem;
    color: #475569;
    line-height: 1.6;
    font-size: 0.98rem;
}

/* small meta & contact */
.course-modal-footer {
    margin-top: 1rem;
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
}

.course-modal-contact {
    font-size: .95rem;
    color: #475569;
}

/* buttons */
.modal-close-btn,
.modal-action-btn {
    padding: .6rem .9rem;
    border-radius: 999px;
    border: none;
    font-weight: 700;
    cursor: pointer;
}

.modal-close-btn {
    background: transparent;
    color: #64748b;
    border: 1px solid #e6edf3;
}

.modal-action-btn {
    background: var(--secondary-color);
    color: var(--text-light);
}

/* top-right close icon */
.modal-top-right {
    position: absolute;
    top: 14px;
    right: 14px;
}

/* RTL support - move close button to left in Arabic */
[dir="rtl"] .modal-top-right {
    right: auto;
    left: 14px;
}

/* ---------- Modal open animation & overlay fade ---------- */
@keyframes overlayFade {
    0% {
        opacity: 0;
        transform: none;
    }

    100% {
        opacity: 1;
        transform: none;
    }
}

@keyframes modalPop {
    0% {
        opacity: 0;
        transform: translateY(18px) scale(.96) rotateX(6deg);
        filter: blur(6px);
    }

    60% {
        opacity: 1;
        transform: translateY(-6px) scale(1.02) rotateX(0deg);
        filter: blur(0);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0);
        filter: blur(0);
    }
}

/* apply animations when modal shows */
.course-modal-overlay.show {
    animation: overlayFade .22s ease forwards;
}

.course-modal-overlay.show .course-modal {
    animation: modalPop .38s cubic-bezier(.2, .9, .2, 1) forwards;
    will-change: transform, opacity, filter;
}

/* subtle lift & shadow during animation */
.course-modal-overlay.show .course-modal {
    box-shadow: 0 28px 70px rgba(2, 6, 23, 0.30);
}

/* ---------- Darken Contact button slightly ---------- */
/* keep using --secondary-color but darken visually */
.modal-action-btn {
    /* reduce brightness a bit for darker appearance */
    filter: brightness(0.88);
    transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.12);
}

/* stronger hover feedback */
.modal-action-btn:hover {
    transform: translateY(-2px);
    filter: brightness(0.78);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.14);
}

/* focus style */
.modal-action-btn:focus {
    outline: 3px solid rgba(99, 102, 241, 0.18);
    outline-offset: 2px;
}

/* responsive */
@media (max-width: 880px) {
    .course-modal {
        flex-direction: column;
        max-width: 720px;
    }

    .course-modal-visual {
        flex: 0 0 auto;
        width: 100%;
        padding: 1.25rem 1rem;
    }

    .course-modal-content {
        padding: 1.25rem;
    }
}

/* accessibility focus */
.course-modal [tabindex]:focus,
.course-modal button:focus,
.course-modal a:focus {
    outline: 3px solid rgba(99, 102, 241, 0.18);
    outline-offset: 2px;
}

/* subtle divider */
.modal-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(226, 232, 240, 0), rgba(226, 232, 240, 1), rgba(226, 232, 240, 0));
    margin: .8rem 0;
}

/* Responsive Adjustments for Gallery */
@media (max-width: 992px) {
    .masonry-gallery {
        column-count: 2;
    }
}

@media (max-width: 576px) {
    .masonry-gallery {
        column-count: 1;
    }
}