/* --- General & Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;700&display=swap');
body {
    font-family: 'Kanit', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    padding: 0;
}
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 8px;
}

/* --- Section Titles --- */
section h2 {
    text-align: left;
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
}
section > h2 {
    margin-top: 20px;
    margin-bottom: 8px !important;
}

/* --- Verse of the Day --- */
.verse-section {
    padding: 5px 5px 0 5px;
}
.verse-box {
    background: linear-gradient(135deg, #f9fbfd, #e9eff6);
    border-radius: 12px;
    padding: 8px 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid #dcdfe4;
}
.verse-text {
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.4;
    margin: 0 0 4px 0;
}
.verse-ref {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0056b3;
    margin: 0;
    padding: 0;
}

/* --- News Slider (Home) --- */
.news-slider-section {
    padding-top: 0 !important;
    padding-bottom: 0;
}
.swiper-container {
    width: 100%;
    padding-top: 10px;
    padding-bottom: 15px;
}
.swiper-slide {
    background-position: center;
    background-size: cover;
    width: 250px;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.4s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.swiper-slide-active {
    transform: scale(1.1) !important;
    z-index: 10;
}
.swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Programs Grid with Card (Light Mode) --- */
.programs-section {
    padding-top: 15px;
    padding-bottom: 20px;
}
.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding: 20px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}
.programs-grid:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    transform: translateY(-2px);
}
.program-card {
    border-radius: 12px;
    overflow: hidden;
    background: #f8f9fa;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.program-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.program-card a {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}
.card-image-container {
    position: relative;
    width: 100%;
    padding-top: 140%;
    overflow: hidden;
    background: linear-gradient(45deg, #f0f2f5, #e9ecef);
}
.card-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.program-card:hover .card-image-container img {
    transform: scale(1.02);
}
.card-content {
    padding: 12px;
    text-align: center;
}
.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
    line-height: 1.3;
}

/* --- Other Elements --- */
.program-header {
    position: relative;
    margin-bottom: 20px;
}
.back-button {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: rgba(0,0,0,0.5);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    z-index: 10;
}
#banner-area {
    width: 100%;
    padding-top: 56.25%;
    position: relative;
    background-color: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}
#banner-area.audio-cover-active {
    padding-top: 45%;
}
#banner-area img, #banner-area iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}
.program-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}
.tab-link {
    padding: 10px 20px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
    color: #888;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}
.tab-link.active {
    color: #0056b3;
    font-weight: 700;
    border-bottom-color: #0056b3;
}
#content-area {
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 10px;
}
.list-item {
    padding: 10px 15px;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: 1px solid #eee;
    font-size: 0.9rem;
}
.list-item:hover {
    background-color: #e9f5ff;
}
.banner-title-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.6) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}
.banner-title-overlay h1 {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
}
#audio-player-container {
    position: fixed;
    bottom: -150px;
    left: 0;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: bottom 0.4s ease-in-out;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
#audio-player-container.visible {
    bottom: 0;
}
#player-cover {
    width: 60px;
    height: 40px !important;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}
#player-info {
    flex-grow: 1;
    min-width: 0;
}
#player-controls {
    flex-shrink: 0;
    padding-right: 5px;
}
#player-title {
    font-weight: 700;
    margin: 0;
}
#player-controls button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}
#player-timeline {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}
#player-seek {
    width: 100%;
}

/* --- News Detail Page --- */
.news-header .news-title {
    font-size: 1.8rem !important;
    color: #17a2b8 !important;
    font-weight: 700;
}

/* --- Article Display Mode --- */
#content-area.article-mode {
    max-height: none;
    overflow-y: visible;
}
#content-area.article-mode img,
.article-content img,
#content-area img {
    max-width: 100% !important;
    height: auto !important;
    width: auto !important;
    display: block;
    margin: 10px auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    object-fit: contain;
}
.article-content {
    overflow: hidden;
    word-wrap: break-word;
}
.article-content * {
    max-width: 100% !important;
    box-sizing: border-box;
}

/* === DARK MODE STYLES === */
body.dark-mode {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

/* Dark Mode for Programs Grid */
body.dark-mode .programs-grid {
    background: #1e1e1e !important;
    box-shadow: 0 8px 30px rgba(255,255,255,0.1) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}
body.dark-mode .programs-grid:hover {
    box-shadow: 0 12px 40px rgba(255,255,255,0.15) !important;
}
body.dark-mode .program-card {
    background: #2d2d2d !important;
    box-shadow: 0 3px 10px rgba(255,255,255,0.05) !important;
}
body.dark-mode .program-card:hover {
    box-shadow: 0 8px 20px rgba(255,255,255,0.1) !important;
}
body.dark-mode .card-title {
    color: #f8f9fa !important;
}

/* Dark Mode for List Items */
body.dark-mode .list-item {
    background-color: #2d2d2d !important;
    color: #f8f9fa !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}
body.dark-mode .list-item:hover {
    background-color: #3d3d3d !important;
    color: #ffffff !important;
}

/* Dark Mode for Verse Box */
body.dark-mode .verse-box {
    background: linear-gradient(135deg, #2d2d2d, #1e1e1e) !important;
    color: #e0e0e0 !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}
body.dark-mode .verse-ref {
    color: #4dabf7 !important;
}

/* Dark Mode for All Text Elements */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #f8f9fa !important;
}
body.dark-mode p,
body.dark-mode span,
body.dark-mode div {
    color: #e0e0e0 !important;
}
body.dark-mode a {
    color: #4dabf7 !important;
}

/* Dark Mode for Container & Content Areas */
body.dark-mode .container,
body.dark-mode .news-content,
body.dark-mode .article-content {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}
body.dark-mode #content-area {
    background-color: #1e1e1e !important;
}

/* Dark Mode for Tabs */
body.dark-mode .program-tabs {
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
}
body.dark-mode .tab-link {
    color: #adb5bd !important;
}
body.dark-mode .tab-link.active {
    color: #4dabf7 !important;
    border-bottom-color: #4dabf7 !important;
}

/* Dark Mode for Back Button */
body.dark-mode .back-button {
    background-color: rgba(255,255,255,0.2) !important;
    color: #fff !important;
}

/* Dark Mode for News Header */
body.dark-mode .news-header .news-title {
    color: #4dabf7 !important;
}

/* Dark Mode for Audio Player */
body.dark-mode #audio-player-container {
    background-color: #2d2d2d !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4) !important;
    border-top: 1px solid rgba(255,255,255,0.1) !important;
}
body.dark-mode #player-title {
    color: #f8f9fa !important;
}
body.dark-mode #player-controls button {
    color: #e0e0e0 !important;
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    position: fixed;
    bottom: 40px;
    right: 40px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,123,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.3s ease;
}
.dark-mode-toggle:hover {
    background: #0056b3;
    transform: scale(1.1);
}
body.dark-mode .dark-mode-toggle {
    background: #ffc107 !important;
    color: #000 !important;
    box-shadow: 0 4px 15px rgba(255,193,7,0.4) !important;
}
body.dark-mode .dark-mode-toggle:hover {
    background: #e0a800 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .swiper-slide {
        width: 200px;
        height: 112px;
    }
    .banner-title-overlay h1 {
        font-size: 1.8rem;
    }
    .programs-grid {
        padding: 15px;
        gap: 15px;
        grid-template-columns: repeat(2, 1fr);
    }
    .card-content {
        padding: 10px;
    }
    .card-title {
        font-size: 0.9rem;
    }
    #content-area {
        max-height: 50vh;
    }
}
/* Dark Mode for News Page */
body.dark-mode .news-content,
body.dark-mode .article-content,
body.dark-mode .news-detail {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

body.dark-mode .news-title {
    color: #4dabf7 !important;
}

body.dark-mode .news-date,
body.dark-mode .news-meta {
    color: #adb5bd !important;
}

body.dark-mode .news-text,
body.dark-mode .news-content p {
    color: #e0e0e0 !important;
}

/* Dark Mode Toggle Button Position */
.dark-mode-toggle {
    position: fixed;
    bottom: 40px;
    right: 40px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: grab;
    box-shadow: 0 4px 15px rgba(0,123,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.3s ease;
    user-select: none;
}

.dark-mode-toggle:hover {
    background: #0056b3;
    transform: scale(1.05);
}

body.dark-mode .dark-mode-toggle {
    background: #ffc107 !important;
    color: #000 !important;
    box-shadow: 0 4px 15px rgba(255,193,7,0.4) !important;
}

body.dark-mode .dark-mode-toggle:hover {
    background: #e0a800 !important;
}

/* Enhanced Floating Dark Mode Toggle Button */
.dark-mode-toggle {
    position: fixed !important;
    bottom: 40px;
    right: 40px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    font-size: 1.3rem;
    cursor: grab;
    box-shadow: 0 6px 20px rgba(0,123,255,0.4), 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    backdrop-filter: blur(10px);
}

.dark-mode-toggle:hover {
    box-shadow: 0 8px 25px rgba(0,123,255,0.5), 0 4px 15px rgba(0,0,0,0.3);
    transform: scale(1.05) translateY(-2px);
}

.dark-mode-toggle:active {
    transform: scale(0.95);
}

/* Dark Mode Button Styling */
body.dark-mode .dark-mode-toggle {
    background: linear-gradient(135deg, #ffc107, #e0a800) !important;
    color: #000 !important;
    box-shadow: 0 6px 20px rgba(255,193,7,0.4), 0 2px 10px rgba(0,0,0,0.2) !important;
}

body.dark-mode .dark-mode-toggle:hover {
    box-shadow: 0 8px 25px rgba(255,193,7,0.5), 0 4px 15px rgba(0,0,0,0.3) !important;
}

/* Floating Animation */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
}

.dark-mode-toggle {
    animation: float 3s ease-in-out infinite;
}

.dark-mode-toggle:hover {
    animation: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .dark-mode-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.1rem;
        bottom: 30px;
        right: 30px;
    }
}



/* === PATCH v5: stronger icons + more lift for programs on mobile === */

/* Ensure pseudo-element renders with spacing */
.news-slider-section h2,
.programs-section h2 {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
}
.news-slider-section h2::before,
.programs-section h2::before {
  content: "" !important;
  display: inline-block !important;
  width: 1.2em !important;
  height: 1.2em !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;
  margin-right: 2px !important;
}

/* Force icons per theme (avoid dark artifacts) */
body.dark-mode .news-slider-section h2::before { 
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M3 10a2 2 0 0 0-2 2v2a4 4 0 0 0 4 4h1l3 4h2l-1-4h2l8 2V6l-8 2H3z'/%3E%3C/svg%3E") !important;
}
body.dark-mode .programs-section h2::before { 
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M12 3a9 9 0 0 0-9 9v5a3 3 0 0 0 3 3h2v-8H6a3 3 0 0 0-3 3v-3a9 9 0 1 1 18 0v3a3 3 0 0 0-3-3h-2v8h2a3 3 0 0 0 3-3v-5a9 9 0 0 0-9-9z'/%3E%3C/svg%3E") !important;
}
body:not(.dark-mode) .news-slider-section h2::before { 
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23111' d='M3 10a2 2 0 0 0-2 2v2a4 4 0 0 0 4 4h1l3 4h2l-1-4h2l8 2V6l-8 2H3z'/%3E%3C/svg%3E") !important;
}
body:not(.dark-mode) .programs-section h2::before { 
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23111' d='M12 3a9 9 0 0 0-9 9v5a3 3 0 0 0 3 3h2v-8H6a3 3 0 0 0-3 3v-3a9 9 0 1 1 18 0v3a3 3 0 0 0-3-3h-2v8h2a3 3 0 0 0 3-3v-5a9 9 0 0 0-9-9z'/%3E%3C/svg%3E") !important;
}

/* Mobile lift: pull both up more, especially programs */
@media (max-width: 768px) {
  .news-slider-section { margin-top: -10px !important; }
  .programs-section { margin-top: -32px !important; }
  .news-slider-section h2, .programs-section h2 { font-size: 1.15rem !important; }
}



/* === Admin uniform thumbnails (4:3, enforced) === */
.admin-table .thumb-cell { 
  width: 180px; 
  height: 120px;        /* fix cell height so every row is equal */
  text-align: center; 
  vertical-align: middle;
}
.thumb-frame {
  width: 160px;
  height: 120px;        /* 4:3 ratio */
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  display: inline-block;
}
.thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Social Share Buttons */
.social-share-container {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

.social-share-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.social-share-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.share-btn i {
    font-size: 1.1rem;
}

.share-facebook {
    background: linear-gradient(135deg, #1877f2 0%, #0c63d4 100%);
}

.share-twitter {
    background: linear-gradient(135deg, #1da1f2 0%, #0d8bd9 100%);
}

.share-line {
    background: linear-gradient(135deg, #00b900 0%, #00a000 100%);
}

.share-whatsapp {
    background: linear-gradient(135deg, #25d366 0%, #1ebe57 100%);
}

.share-telegram {
    background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
}

.share-copy {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.share-copy.copied {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* Dark Mode */
body.dark-mode .social-share-container {
    background: #2c3e50;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

body.dark-mode .social-share-title {
    color: #ecf0f1;
}

/* Responsive */
@media (max-width: 768px) {
    .social-share-buttons {
        gap: 0.5rem;
    }
    
    .share-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        flex: 1 1 calc(50% - 0.25rem);
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .share-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .share-btn span {
        display: none;
    }
}
/* ===================================
   Mobile: Program Card Text Smaller (Force Override)
   =================================== */
@media (max-width: 768px) {
    /* ชื่อรายการภาษาไทย - Force Override */
    .program-card .program-info .program-title,
    .program-info .program-title,
    .program-title {
        font-size: 0.8rem !important;
        font-weight: 400 !important;
        margin-bottom: 0.2rem !important;
        line-height: 1.25 !important;
    }
    
    /* ชื่อรายการภาษาอังกฤษ - Force Override */
    .program-card .program-info .program-title-en,
    .program-info .program-title-en,
    .program-title-en,
    .program-title span {
        font-size: 0.65rem !important;
        font-weight: 300 !important;
        margin-top: 0.1rem !important;
        opacity: 0.85 !important;
    }
    
    /* ปรับ padding */
    .program-card .program-info,
    .program-info {
        padding: 0.7rem !important;
    }
}

/* สำหรับมือถือเล็กมาก */
@media (max-width: 400px) {
    .program-title {
        font-size: 0.75rem !important;
        font-weight: 400 !important;
    }
    
    .program-title-en,
    .program-title span {
        font-size: 0.6rem !important;
        font-weight: 300 !important;
    }
}
