/* Section Overlay (Modal พื้นหลังดำ) */
.section-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.85); backdrop-filter: blur(10px); z-index: 3000; display: none; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; }
.section-overlay.active { display: flex; opacity: 1; }
.section-container { width: 100%; max-width: 450px; height: 85vh; position: relative; padding: 0; }
#close-section-btn { position: absolute; top: -40px; right: 0; color: #fff; font-size: 2.5rem; background: none; border: none; cursor: pointer; }

/* Swiper Cards */
.portfolio-swiper { width: 100%; height: 100%; padding-bottom: 40px; }
.item-card { background: #ffffff; border-radius: 25px; overflow: hidden; height: 100%; display: flex; flex-direction: column; box-shadow: 0 15px 35px rgba(0,0,0,0.2); cursor: grab; }
.item-card:active { cursor: grabbing; }
.card-img-box { width: 100%; height: 45%; overflow: hidden; background: #f0f0f0; cursor: zoom-in; }
.card-img-box img { width: 100%; height: 100%; object-fit: cover; }
.card-info { padding: 25px; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; flex: 1; text-align: left; user-select: none; }
.card-info h3 { color: #2d3436; font-size: var(--card-title-size); font-weight: 800; line-height: 1.2; }
.card-info p { font-size: var(--card-text-size); color: #636e72; line-height: 1.6; }

/* Tags & Skills */
.tag-container { display: flex; flex-wrap: wrap; gap: 10px; }
.pill-tag { padding: 6px 15px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; color: #fff; }
.pill-tag:nth-child(odd) { background: #d96a89; }
.pill-tag:nth-child(even) { background: #f05c26; }
.skills-header { font-size: 0.9rem; font-weight: 800; color: #555; margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.skills-list { display: flex; flex-direction: column; gap: 10px; margin-top: 5px; }
.skill-heading-pill { background: var(--sh-bg); color: var(--sh-txt); padding: 10px 15px; border-radius: 10px; font-size: var(--card-text-size); font-weight: 800; margin-top: 10px; border-left: 5px solid var(--sh-txt); }
.skill-item-pill { background: var(--si-bg); color: var(--si-txt); padding: 8px 15px; border-radius: 20px; font-size: calc(var(--card-text-size) * 0.9); font-weight: 600; margin-left: 20px; border: 1px solid rgba(0,0,0,0.05); display: flex; align-items: center; gap: 10px; word-break: break-word; }

/* Gallery Mini Grid */
.gallery-header { margin-top: 20px; border-top: 1px solid #eee; padding-top: 15px; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.gallery-item-wrapper { aspect-ratio: 1; border-radius: 8px; overflow: hidden; cursor: pointer; border: 1px solid rgba(0,0,0,0.05); transition: transform 0.3s; }
.gallery-item-wrapper:hover { transform: scale(1.05); }
.gallery-item-img { width: 100%; height: 100%; object-fit: cover; }

/* Swiper Overrides */
.swiper-pagination-bullet { background: #fff !important; opacity: 0.5; }
.swiper-pagination-bullet-active { opacity: 1; background: var(--primary-color) !important; }
.swiper-button-next, .swiper-button-prev { color: #fff !important; transform: scale(0.6); top: 50%; }
.swiper-button-next { right: -20px; }
.swiper-button-prev { left: -20px; }

/* Certificate Grid */
.cert-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 10px; width: 100%; max-height: 75vh; overflow-y: auto; }
.cert-card { background: #fff; border-radius: 15px; padding: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); cursor: pointer; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s; border: 1px solid rgba(0,0,0,0.02); display: flex; flex-direction: column; }
.cert-card:hover { transform: translateY(-8px); box-shadow: 0 15px 35px rgba(108, 92, 231, 0.15); border-color: var(--secondary-color); }
.cert-img-box { width: 100%; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: #f4f4f9; margin-bottom: 15px; }
.cert-img-box img { width: 100%; height: 100%; object-fit: cover; }
.cert-title { font-weight: 700; color: var(--primary-color); font-size: 1.1rem; line-height: 1.4; text-align: center; }

/* Smart Lightbox */
.lightbox-overlay { z-index: 99999; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.95); display: none; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; padding: 20px; }
.lightbox-overlay.active { display: flex; opacity: 1; }
.smart-lightbox-box { background: #fff; padding: 30px; border-radius: 20px; max-width: 90vw; width: 650px; max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; align-items: center; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.3); transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.lightbox-overlay.active .smart-lightbox-box { transform: scale(1); }
.smart-lightbox-box img { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 10px; background: #f9f9f9; }
.lightbox-text-container { width: 100%; text-align: left; }
.lightbox-text-container h3 { color: var(--primary-color); margin-bottom: 10px; font-size: 1.5rem; border-bottom: 2px solid rgba(108, 92, 231, 0.1); padding-bottom: 10px; }
.lightbox-text-container p { font-size: 1rem; color: #636e72; background: rgba(0,0,0,0.02); padding: 15px; border-radius: 10px; line-height: 1.6; }
.lightbox-nav-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.6); color: #fff; border: none; font-size: 2rem; width: 50px; height: 50px; border-radius: 50%; cursor: pointer; z-index: 100000; transition: background 0.3s; }
.lightbox-nav-btn:hover { background: var(--primary-color); }

/* ⚡️ สไตล์ใหม่: สื่อการสอน แนวนอน 16:9 ⚡️ */
.media-list-container {
    display: flex; flex-direction: column; gap: 20px; width: 100%; padding: 10px; max-height: 75vh; overflow-y: auto;
}
.media-horizontal-card {
    display: flex; flex-direction: row; background: #ffffff; border-radius: 15px; overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; text-align: left;
}
.media-horizontal-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }
.media-img-box { width: 45%; aspect-ratio: 16 / 9; background: #000; position: relative; }
.media-img-box img { width: 100%; height: 100%; object-fit: cover; }
.media-badge { position: absolute; top: 10px; left: 10px; padding: 5px 12px; border-radius: 8px; font-size: 0.75rem; font-weight: bold; color: #fff; z-index: 2; }
.media-info-box { width: 55%; padding: 20px; display: flex; flex-direction: column; justify-content: center; }
.media-info-box h3 { margin: 0 0 10px 0; font-size: 1.2rem; color: var(--primary-color); }
.media-info-box p { margin: 0; font-size: 0.9rem; color: #555; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 768px) {
    .media-horizontal-card { flex-direction: column; }
    .media-img-box, .media-info-box { width: 100%; }
}

/* ⚡️ สไตล์ใหม่: Smart Gallery (สำหรับปุ่มโหลดไฟล์/วิดีโอ) ⚡️ */
.smart-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 15px; }
.smart-gallery-item { width: 100%; height: 100px; border-radius: 10px; object-fit: cover; cursor: pointer; border: 1px solid #eee; transition: transform 0.2s; }
.smart-gallery-item:hover { transform: scale(1.05); }
.smart-video { width: 100%; height: 100px; border-radius: 10px; object-fit: cover; background: #000; }
.smart-file-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f8f9fa; border: 2px dashed #ccc; border-radius: 10px; height: 100px; text-decoration: none; color: #333; transition: all 0.3s; text-align: center; padding: 10px; }
.smart-file-btn:hover { background: rgba(108, 92, 231, 0.1); border-color: var(--primary-color); color: var(--primary-color); transform: translateY(-3px); }
.smart-file-icon { font-size: 2rem; margin-bottom: 5px; }
.smart-file-name { font-size: 0.75rem; font-weight: bold; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }