:root {
    --color-blue: #00BFFF;
    --color-gold: #FFD700;
    --bg-gradient: linear-gradient(135deg, #FF7F50 0%, #FFA500 100%);
    --card-bg: rgba(15, 15, 15, 0.98);
    --physics-brown: #c68642; 
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 40px 20px;
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    color: white;
    user-select: none;
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

.header-section {
    text-align: center;
    margin-bottom: 40px;
    transition: opacity 0.3s ease;
}

h1 {
    font-size: 3em;
    font-weight: 800;
    color: var(--color-gold);
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    margin: 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.card-anchor {
    position: relative;
    height: 400px;
    cursor: pointer;
}

.course-card {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--physics-brown);
    border-radius: 28px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-anchor:hover .course-card:not(.expanded) {
    transform: scale(1.03);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

#modalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    z-index: 9000;
}

body.modal-open #modalOverlay {
    opacity: 1;
    visibility: visible;
}

/* EXPANDED STATE */
.course-card.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    width: 90vw;
    height: 80vh;
    max-width: 1200px;
    z-index: 9999;
    flex-direction: row;
    background: var(--card-bg);
    border: 2px solid var(--color-gold);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.media-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: #000;
    transition: all 0.5s ease;
    flex-shrink: 0;
}

.course-card.expanded .media-container {
    width: 70%;
    height: 100%;
}

.thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
    z-index: 2;
}

.card-anchor:hover .thumbnail {
    opacity: 0;
}

.course-card.expanded .thumbnail {
    display: none;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: black;
}

.course-card.expanded video {
    object-fit: contain;
}

/* ΠΕΡΙΟΧΗ ΚΕΙΜΕΝΟΥ */
.course-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;    /* Κεντράρισμα οριζόντια */
    justify-content: center; /* Κεντράρισμα κάθετα */
    text-align: center;
    flex-grow: 1;
    overflow: hidden;
    background: var(--physics-brown);
}

.course-card.expanded .course-info {
    width: 30%;
    padding: 40px;
    background: transparent;
}

/* ΤΙΤΛΟΣ ΜΕ ΑΛΛΑΓΗ ΓΡΑΜΜΗΣ */
h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 900;
    color: white;
    line-height: 1.2;
    text-transform: uppercase;
    display: flex;
    flex-direction: column; /* Αναγκάζει το κείμενο να μπει σε στοίβη */
    gap: 5px;
}

/* Μικρότερο στυλ για το "2Η ΕΝΟΤΗΤΑ:" αν το βάλεις σε span */
h3 span {
    font-size: 0.7em;
    opacity: 0.9;
    font-weight: 600;
}

.course-card.expanded h3 {
    font-size: 1.8em;
    color: var(--color-gold);
    margin-bottom: 20px;
}

.course-summary {
    display: none;
    font-size: 0.95em;
    line-height: 1.6;
    color: #ddd;
    margin-top: 10px;
}

.course-card.expanded .course-summary {
    display: block;
}

.badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--color-blue);
    color: #000;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 900;
    z-index: 10;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    color: white;
    font-size: 20px;
    transition: all 0.2s;
}

.course-card.expanded .close-btn {
    display: flex;
}

.lessons-count {
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--color-gold);
    font-weight: 700;
}

@media (max-width: 1024px) {
    .course-card.expanded {
        flex-direction: column;
        height: 90vh;
        width: 95vw;
    }

    .course-card.expanded .media-container {
        width: 100%;
        height: 45%;
    }

    .course-card.expanded .course-info {
        width: 100%;
        padding: 25px;
        overflow-y: auto;
    }
}