/* --- 1. GLOBAL FONT & RESET --- */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

* { box-sizing: border-box; }

body, h1, h2, h3, h4, h5, h6, p, a, span, li, button, input {
    font-family: 'Sarabun', sans-serif !important;
}

/* --- 2. GRID & LAYOUT STRUCTURE --- */
.klab-premium-board, .klab-pr-grid {
    max-width: 1200px; 
    margin: 0 auto; 
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}
.klab-premium-board { padding: 30px 0; }
.klab-pr-grid { padding: 10px 0 50px 0; }

.klab-video-showcase { max-width: 1200px; margin: 40px auto; }
.klab-vid-grid { display: grid; grid-template-columns: 3.2fr 1fr; gap: 20px; }
.klab-vid-sidebar { display: flex; flex-direction: column; justify-content: space-between; height: 100%; }

.klab-quick-links {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px; max-width: 1200px; margin: 40px auto;
}

/* --- 3. COMPONENTS (Cards, Headers, Buttons) --- */

/* Headers & Badges */
.klab-section-header { text-align: center; margin-bottom: 40px; display: flex; flex-direction: column; align-items: center; }
.klab-main-title { margin: 0; font-size: 2.2rem; font-weight: 600; color: #1e293b; position: relative; padding-bottom: 15px; }
.klab-main-title::after {
    content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 60px; height: 3px; background: #2563eb; border-radius: 3px;
}
.klab-badge {
    display: inline-flex; align-items: center; color: #64748b; font-size: 0.8rem; font-weight: 600; 
    letter-spacing: 2px; margin-bottom: 8px; text-transform: uppercase;
}

/* Cards (News & PR) */
.klab-p-card, .klab-pr-card { 
    background: #ffffff; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; 
    border: 1px solid #f1f5f9; box-shadow: 0 4px 12px rgba(0,0,0,0.04); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); text-decoration: none;
}
.klab-p-card:hover, .klab-pr-card:hover { transform: translateY(-6px); box-shadow: 0 12px 30px rgba(0,0,0,0.08); }

.klab-pr-img-box { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; margin-bottom: 0; }
.klab-pr-img-box img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.klab-pr-card:hover .klab-pr-img-box img { transform: scale(1.05); }

.klab-p-body { padding: 20px 24px 10px 24px; flex-grow: 1; }
.klab-pr-content { padding: 20px 24px; background: #ffffff; display: flex; flex-direction: column; flex-grow: 1; }

.klab-p-item { display: flex; flex-direction: column; padding: 20px 0; border-bottom: 1px solid #f1f5f9; text-decoration: none; transition: transform 0.3s ease; }
.klab-p-item:last-child { border-bottom: none; }
.klab-p-item:hover { transform: translateX(6px); }

/* Typography & Meta */
.klab-p-title, .klab-pr-title { 
    font-weight: 500; line-height: 1.5; margin-bottom: 8px; transition: color 0.3s;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.klab-p-title { color: #334155; font-size: 1rem; }
.klab-pr-title { color: #1e293b; font-size: 1.1rem; font-weight: 600; }
.klab-p-item:hover .klab-p-title, .klab-pr-card:hover .klab-pr-title { color: #2563eb; }

.klab-p-meta, .klab-pr-meta { display: flex; align-items: center; font-size: 0.85rem; color: #64748b; font-weight: 400; }
.klab-p-meta svg, .klab-pr-meta svg { width: 13px !important; height: 13px !important; margin-right: 6px; fill: #94a3b8; }

/* Status Indicators */
.pulse-dot { width: 6px; height: 6px; background: #ef4444; border-radius: 50%; margin-right: 8px; animation: pulse-red 2s infinite; }
.klab-p-item:not(:first-child) .klab-p-title::before { content: "▪"; color: #cbd5e1; font-size: 1.2rem; margin-right: 8px; vertical-align: middle; display: inline-block; transform: translateY(-2px); }
.klab-p-item:first-child .klab-p-title::before {
    content: "✨ ล่าสุด"; display: inline-block; background: #ef4444; color: #ffffff; font-size: 0.7rem; font-weight: 500;
    padding: 2px 8px; border-radius: 20px; margin-right: 8px; vertical-align: middle; transform: translateY(-2px);
    animation: pulse-badge 2s infinite; 
}

/* Buttons */
.klab-p-btn { display: block; text-align: center; padding: 12px 0; margin: 0 24px 24px 24px; border-radius: 8px; font-size: 0.95rem; font-weight: 500; text-decoration: none; transition: all 0.3s; border: 1px solid transparent; }
.klab-p-btn::after { content: " →"; display: inline-block; font-weight: 600; transform: translateX(0); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.klab-p-btn:hover::after { transform: translateX(6px); }
.btn-blue { background: #eff6ff; color: #1e3a8a; } .btn-blue:hover { background: #2563eb; color: #ffffff; }
.btn-green { background: #ecfdf5; color: #047857; } .btn-green:hover { background: #059669; color: #ffffff; }
.btn-orange { background: #fffbeb; color: #b45309; } .btn-orange:hover { background: #d97706; color: #ffffff; }

/* Quick Links Cards */
.klab-ql-card { display: flex; align-items: center; background: #ffffff; padding: 20px 24px; border-radius: 16px; border: 1px solid #f1f5f9; box-shadow: 0 4px 15px rgba(0,0,0,0.03); text-decoration: none; transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.klab-ql-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(0,0,0,0.08); border-color: #cbd5e1; }
.klab-ql-icon { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-right: 20px; flex-shrink: 0; transition: transform 0.3s ease; }
.klab-ql-card:hover .klab-ql-icon { transform: scale(1.1) rotate(-3deg); }
.klab-ql-icon svg { width: 24px; height: 24px; fill: #ffffff; }
.klab-ql-rms .klab-ql-icon { background: linear-gradient(135deg, #3b82f6, #1e3a8a); }
.klab-ql-fb .klab-ql-icon { background: linear-gradient(135deg, #1877F2, #0c5ce6); }
.klab-ql-tt .klab-ql-icon { background: linear-gradient(135deg, #0f172a, #334155); }
.klab-ql-text h4 { margin: 0 0 4px 0; font-size: 1.1rem; font-weight: 600; color: #1e293b; }
.klab-ql-text p { margin: 0; font-size: 0.85rem; color: #64748b; }
.klab-ql-arrow { margin-left: auto; color: #cbd5e1; font-weight: 600; font-size: 1.2rem; transition: 0.3s ease; }
.klab-ql-card:hover .klab-ql-arrow { transform: translateX(6px); color: #2563eb; }

/* Visitor Badge */
.klab-visitor-badge { display: inline-flex; align-items: center; background: linear-gradient(135deg, #0f172a, #1e293b); padding: 12px 24px; border-radius: 50px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); border: 1px solid #334155; transition: 0.3s ease; }
.klab-visitor-badge:hover { transform: translateY(-3px); }
.klab-visitor-icon { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; background: rgba(37, 99, 235, 0.2); border-radius: 50%; margin-right: 15px; animation: pulse-visitor 2s infinite; }
.klab-visitor-icon svg { width: 20px; height: 20px; fill: #60a5fa; }
.klab-visitor-info { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.klab-visitor-label { font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; }
.klab-visitor-count { font-size: 1.3rem; font-weight: 700; color: #ffffff; letter-spacing: 0.5px; }

/* Break Banner */
.klab-break-banner {
    position: relative; width: 100%; margin: 50px 0; padding: 40px 20px; border-radius: 16px; text-align: center; overflow: hidden;
    background: linear-gradient(-45deg, #1e3a8a, #3b82f6, #1d4ed8, #0ea5e9); background-size: 400% 400%; animation: gradientMove 10s ease infinite; box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
}
.klab-bb-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.klab-bb-title { color: #ffffff !important; font-size: 1.8rem !important; font-weight: 600 !important; margin: 0 0 10px 0 !important; letter-spacing: 0.5px !important; }
.klab-bb-subtitle { color: #e0f2fe !important; font-size: 1rem !important; margin: 0 0 25px 0 !important; }
.klab-bb-btn { display: inline-flex; align-items: center; background: #ffffff; color: #1e3a8a; font-weight: 500; padding: 12px 28px; border-radius: 50px; text-decoration: none !important; transition: 0.3s ease; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.klab-bb-btn span { margin-left: 8px; transition: transform 0.3s ease; }
.klab-bb-btn:hover { background: #f8fafc; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.klab-bb-btn:hover span { transform: translateX(4px); }

/* --- 4. WIDGETS & MEDIA (Video, Gallery, Modal) --- */

/* Video Showcase & Custom YouTube */
.klab-video-heading { text-align: center; font-size: 2rem; font-weight: 600; color: #1e293b; margin-bottom: 30px; }
.klab-video-heading span { color: #7e22ce; }
.klab-vid-main, .klab-vid-sub { position: relative; width: 100%; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.15); background: #0f172a; }
.klab-vid-main { aspect-ratio: 16 / 9; }
.klab-vid-sub { height: calc((100% - 40px) / 3); }
.klab-vid-main iframe, .klab-vid-sub iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
.klab-custom-yt-wrapper { display: flex; flex-direction: column; gap: 15px; }
.klab-yt-box { position: relative; display: block; width: 100%; border-radius: 12px; overflow: hidden; text-decoration: none !important; background-color: #000; aspect-ratio: 16 / 9; box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: 0.3s ease; }
.klab-yt-thumb { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.3s ease; }
.klab-yt-overlay { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.4) 100%); display: flex; flex-direction: column; justify-content: space-between; padding: 12px 15px; }
.klab-yt-title { color: #ffffff; font-size: 0.95rem; font-weight: 500; line-height: 1.3; text-shadow: 1px 1px 3px rgba(0,0,0,0.8); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.klab-yt-playbtn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 48px; height: 48px; color: rgba(255, 0, 0, 0.9); transition: 0.2s ease-in-out; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
.klab-yt-playbtn svg { width: 100%; height: 100%; fill: currentColor; }
.klab-yt-box:hover { transform: translateY(-2px); box-shadow: 0 8px 15px rgba(0,0,0,0.4); }
.klab-yt-box:hover .klab-yt-thumb { opacity: 0.8; }
.klab-yt-box:hover .klab-yt-playbtn { color: #ff0000; transform: translate(-50%, -50%) scale(1.1); }

/* Modal Popup */
.klab-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.85); z-index: 99999; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; }
.klab-modal-overlay.show-modal { display: flex; opacity: 1; }
.klab-modal-content { position: relative; max-width: 85%; max-height: 90vh; animation: modal-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.klab-modal-content img { max-width: 100%; max-height: 85vh; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); display: block; object-fit: contain; }
.klab-close-btn { position: absolute; top: -15px; right: -15px; width: 40px; height: 40px; background: #ef4444; color: #ffffff; border-radius: 50%; text-align: center; line-height: 36px; font-size: 28px; font-weight: bold; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: 0.2s ease; z-index: 2; border: 2px solid #ffffff; }
.klab-close-btn:hover { transform: scale(1.1) rotate(90deg); background: #dc2626; }

/* --- 5. FOOTER ARCHITECTURE --- */
.klab-footer-brand-box { display: flex !important; flex-direction: row !important; align-items: flex-start !important; justify-content: flex-start !important; gap: 20px !important; text-align: left !important; margin-bottom: 20px !important; }
.klab-fb-logo { flex-shrink: 0 !important; width: 75px !important; height: 75px !important; margin-top: 5px !important; padding: 0 !important; }
.klab-fb-logo img { width: 100% !important; height: auto !important; max-width: 75px !important; display: block !important; margin: 0 !important; border-radius: 50% !important; box-shadow: 0 4px 10px rgba(0,0,0,0.2) !important; }
.klab-fb-text { display: flex !important; flex-direction: column !important; line-height: 1.2 !important; }
.klab-fb-th { margin: 0 0 4px 0 !important; font-size: 1.3rem !important; font-weight: 500 !important; color: #ffffff !important; border: none !important; padding: 0 !important; text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important; }
.klab-fb-en { font-size: 0.85rem !important; font-weight: 400 !important; color: #cbd5e1 !important; margin: 0 !important; }

#footer-navigation { display: block !important; width: 100% !important; }
#footer-navigation::before {
    content: "เกี่ยวกับเรา"; display: block !important; width: 100% !important; color: #ffffff !important; font-size: 1.25rem !important; font-weight: 500 !important; margin-bottom: 20px !important; padding-bottom: 12px !important;
    background-image: linear-gradient(#3b82f6, #3b82f6) !important; background-size: 40px 3px !important; background-position: left bottom !important; background-repeat: no-repeat !important;
}
#footer-navigation ul { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 12px 20px !important; list-style: none !important; padding: 0 !important; margin: 0 !important; text-align: left !important; }
#footer-navigation ul li { display: flex !important; margin: 0 !important; padding: 0 !important; border: none !important; }
#footer-navigation ul li a { color: #cbd5e1 !important; font-size: 0.95rem !important; text-decoration: none !important; display: inline-flex !important; align-items: center !important; transition: 0.3s ease !important; width: 100% !important; line-height: 1.4 !important; }
#footer-navigation ul li a::before { content: "›" !important; margin-right: 10px !important; font-size: 1.5rem !important; color: #3b82f6 !important; line-height: 0 !important; transform: translateY(-2px) !important; transition: 0.3s ease !important; }
#footer-navigation ul li a:hover { color: #ffffff !important; transform: translateX(6px) !important; }
#footer-navigation ul li a:hover::before { color: #60a5fa !important; }
#footer-navigation .widget-title, #footer-navigation h2, #footer-navigation h3 { display: none !important; } /* ซ่อนหัวข้อเดิมที่มากับธีม */

/* --- 6. GLOBAL ANIMATIONS --- */
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
@keyframes pulse-badge { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); } 70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
@keyframes pulse-blue { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } }
@keyframes pulse-visitor { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); } 70% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); } 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } }
@keyframes premium-wiggle { 0% { transform: rotate(0deg) scale(1); } 25% { transform: rotate(-2deg) scale(1.02); } 50% { transform: rotate(2deg) scale(1.02); } 75% { transform: rotate(-1deg) scale(1.01); } 100% { transform: rotate(0deg) scale(1); } }
@keyframes modal-pop { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes gradientMove { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* --- 7. RESPONSIVE QUERIES --- */
@media (max-width: 992px) {
    .klab-vid-grid { grid-template-columns: 1fr; }
    .klab-vid-sidebar { flex-direction: row; overflow-x: auto; padding-bottom: 10px; }
    .klab-vid-sub { flex: 0 0 30%; }
}

@media (max-width: 768px) {
    #footer-navigation ul { grid-template-columns: 1fr !important; }
}

@media (max-width: 576px) {
    .klab-vid-sidebar { flex-direction: column; }
    .klab-vid-sub { flex: auto; }
}