/* DGA Slide News - แก้ไข UI ให้สมบูรณ์ พร้อม Thumbnail Pagination และ Dynamic Height
 * Version: 1.0.7 - ปรับปรุงลบฟิลเตอร์สีดำออก
 */

/* Base Styles */
body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Slider Container with Dynamic Height Support */
#slider-container {
    position: relative;
    width: 100%;
    height: var(--slider-height, 100vh);
    min-height: 400px;
    overflow: hidden;
    background-color: #1a202c;
    color: white;
    z-index: 1;
}

/* Featured Slide */
#featured-slide {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Featured Image Styles */
#featured-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.05);
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
}

/* ปรับปรุง: ลดความเข้มของ overlay หรือเอาออกเลย - เปลี่ยนจากฟิลเตอร์มืดเป็นแค่เงาเบาๆ สำหรับข้อความ */
#featured-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    /* เปลี่ยนจาก gradient มืดเป็น gradient เบาๆ เฉพาะที่ข้อความ */
    background: linear-gradient(to bottom, 
        transparent 0%, 
        transparent 60%, 
        rgba(0,0,0,0.2) 80%, 
        rgba(0,0,0,0.4) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Right Thumbnails Area */
#right-thumbnails-area {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 25%;
    max-width: 320px;
    z-index: 20;
    padding-top: min(100px, calc(var(--slider-height, 100vh) * 0.1));
    padding-right: 16px;
    padding-left: 16px;
    background-color: transparent;
    backdrop-filter: blur(5px);
    border-style: none;
    display: flex;
    flex-direction: column;
    transform: translatey(calc(var(--slider-height, 100vh) * 0.45));
    border-radius: 10px;
}

/* Thumbnail Navigation Buttons */
.thumbnail-nav-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.thumb-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.thumb-nav-btn:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.thumb-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.thumb-nav-btn svg {
    width: 18px;
    height: 18px;
}

.thumb-page-indicator {
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    opacity: 0.8;
}

/* Thumbnails Wrapper */
#thumbnails-wrapper {
    height: 100%;
    overflow-y: auto;
    padding-right: 8px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    z-index: 21;
}

#thumbnails-wrapper::-webkit-scrollbar {
    display: none;
}

/* Thumbnails Container */
#thumbnails-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 11px;
    z-index: 22;
    transition: opacity 0.3s ease-in-out;
}

/* Thumbnail Card */
.thumbnail-card {
    position: relative;
    width: 100%;
    height: max(80px, min(100px, calc(var(--slider-height, 100vh) * 0.1)));
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.3s ease-in-out, border-color 0.3s ease-in-out;
    z-index: 23;
    padding-bottom: 0px;
    animation: fadeIn 0.5s;
}

.thumbnail-card:hover {
    transform: translateY(-2px);
}

.thumbnail-card.active {
    border-color: #f8b64c;
    transform: scale(1.05);
}

.thumbnail-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
    min-width: 338px;
}

.thumbnail-card:hover img {
    transform: scale(1.1);
}

/* ปรับปรุง: ลด Thumbnail Gradient Overlay ให้เบาลง */
.thumbnail-card::after {
    content: '';
    position: absolute;
    inset: 0;
    /* เปลี่ยนจาก gradient มืดเป็น gradient เบาๆ เฉพาะที่ข้อความ */
    background: linear-gradient(to top, 
        rgba(0,0,0,0.5) 0%, 
        rgba(0,0,0,0.2) 40%, 
        transparent 70%
    );
    pointer-events: none;
}

.thumbnail-card.active::after {
    background-color: rgba(248, 182, 76, 0.1);
}

/* Thumbnail Text */
.thumbnail-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px;
    z-index: 2;
    text-align: center;
}

.thumbnail-card-content h3 {
    font-size: 10px;
    font-weight: 500;
    color: #f8b64c;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* เพิ่ม text-shadow เพื่อให้อ่านง่ายโดยไม่ต้องใช้ overlay มืด */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.thumbnail-card-title {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-bottom: 20px;
    height: 30px;
    color: #ffffff;
    /* เพิ่ม text-shadow เพื่อให้อ่านง่ายโดยไม่ต้องใช้ overlay มืด */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.thumbnail-card-subtitle {
    font-size: 10px;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Bottom Navigation Area */
#bottom-navigation-area {
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 15;
    padding: 16px 0;
    background-color: transparent;
    backdrop-filter: blur(5px);
    display: flex;
    width: 16%;
    transform: translatex(calc(var(--slider-height, 100vh) * 1.538)) translatey(calc(var(--slider-height, 100vh) * -0.169));
}

#bottom-navigation-area .items-center {
    justify-content: flex-end;
}

/* Text Content Area - ปรับปรุงให้ข้อความอ่านง่ายโดยไม่ต้องพึ่ง overlay มืด */
#featured-text-content {
    position: absolute;
    left: 0;
    bottom: max(80px, calc(var(--slider-height, 100vh) * 0.08));
    z-index: 10;
    padding: 1.5rem;
    max-width: 36rem;
    /* เพิ่ม background สีเบาๆ ให้กับกล่องข้อความแทนการใช้ overlay ทั้งภาพ */
    background: linear-gradient(135deg, 
        rgba(0,0,0,0.4) 0%, 
        rgba(0,0,0,0.6) 100%
    );
    border-radius: 12px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Title sizing based on slider height */
#featured-title {
    font-size: clamp(1.5rem, calc(var(--slider-height, 100vh) * 0.03), 3rem);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.5rem;
    color: #ffffff;
    /* เพิ่ม text-shadow เพื่อให้อ่านง่าย */
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* Supertitle */
#featured-supertitle {
    font-size: clamp(0.7rem, calc(var(--slider-height, 100vh) * 0.012), 1rem);
    color: #f8b64c;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Description */
#featured-description {
    font-size: clamp(0.7rem, calc(var(--slider-height, 100vh) * 0.012), 0.875rem);
    color: #f0f0f0;
    margin-bottom: 1rem;
    line-height: 1.625;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
}

/* CTA Button */
#featured-link {
    display: inline-block;
    background-color: #f8b64c;
    color: #111827;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: clamp(0.7rem, calc(var(--slider-height, 100vh) * 0.012), 1rem);
    transition: background-color 0.3s, transform 0.2s;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#featured-link:hover {
    background-color: rgba(248, 182, 76, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Navigation Buttons */
#prev-slide,
#next-slide {
    padding: 0.5rem;
    border-radius: 9999px;
    transition: background-color 0.3s;
    width: 40px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.4);
    border: none;
    color: white;
    cursor: pointer;
}

#prev-slide:hover,
#next-slide:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

#prev-slide:active,
#next-slide:active {
    background-color: rgba(0, 0, 0, 0.8);
}

#prev-slide:disabled,
#next-slide:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#prev-slide svg,
#next-slide svg {
    width: 24px;
    height: 24px;
}

/* Progress Bar */
#progress-bar {
    height: 100%;
    background-color: #f8b64c;
    transition: width 0.5s ease-in-out;
}

.progress-indicator {
    background-color: #f8b64c;
}

/* Slide Counter */
#slide-counter {
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    text-align: center;
    min-width: 30px;
}

/* Loading State */
.dga-slide-loading {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(8px);
}

/* Error Message */
.dga-error-message {
    background-color: rgba(255, 255, 255, 0.9);
    color: #721c24;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 1rem;
    padding: 1rem;
    max-width: 80%;
    position: relative;
    z-index: 101;
}

/* Hide default slick controls */
.slick-prev,
.slick-next {
    display: none !important;
}

/* Base styles */
.dga-slider, .dga-slider * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Discover button */
.discover-button {
    text-decoration: none;
    color: white !important;
    font-weight: 600;
    transition: opacity 0.3s;
}

.discover-button:hover {
    opacity: 0.9;
}

.discover-button .icon {
    background-color: #f8b64c;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 12px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.items-end {
    align-items: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.justify-between .items-end .items-center {
    margin-bottom: 10px;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.mr-4 {
    margin-right: 1rem;
}

.h-1 {
    height: 0.25rem;
}

.bg-gray-700 {
    background-color: rgba(55, 65, 81, 0.5);
}

.rounded-full {
    border-radius: 9999px;
}

.w-32 {
    width: 8rem;
}

/* Navigation Controls */
.navigation-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 40px;
}

.nav-button {
    width: 40px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0 8px;
}

.nav-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Progress Container */
.progress-container {
    display: flex;
    align-items: center;
    flex: 1;
}

.progress-bar {
    flex-grow: 1;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.2);
    position: relative;
    margin-right: 16px;
}

.standard-bottom-nav {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 40;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

/* Media Queries with Dynamic Height Considerations */
@media (min-width: 640px) {
    #featured-text-content {
        padding: 2rem;
    }
    
    #featured-supertitle {
        margin-bottom: 0.5rem;
    }
    
    #featured-title {
        margin-bottom: 1rem;
    }
    
    #featured-description {
        margin-bottom: 1.5rem;
        -webkit-line-clamp: 3;
    }
    
    #featured-link {
        padding: 0.75rem 1.5rem;
    }
}

@media (min-width: 641px) {
    #right-thumbnails-area {
        height: min(24vh, calc(var(--slider-height, 100vh) * 0.24)) !important;
        padding-bottom: 0px;
        padding-top: 0px;
    }
}

@media (min-width: 768px) {
    #featured-text-content {
        padding: 3rem;
    }
    
    #thumbnails-container .thumbnail-card h3 {
        font-size: 16px;
        color: #ffffff;
        margin-bottom: 7px;
    }
    
    #thumbnails-container .thumbnail-card .thumbnail-card-content {
        padding-top: 0px;
        padding-bottom: 0px;
    }
}

@media (min-width: 769px) {
    #right-thumbnails-area {
        max-width: 700px;
    }
    
    .dga-carousel-navigation .dga-carousel-next svg {
        height: 77px;
    }
    
    .dga-carousel-controls .dga-carousel-dots .dga-carousel-dot {
        width: 15px;
        height: 15px;
    }
}

@media (min-width: 1024px) {
    #featured-text-content {
        padding: 4rem;
        max-width: 42rem;
    }
}

/* Responsive adjustments for different heights */
@media (max-width: 1280px) {
    .thumbnails-container {
        max-width: 700px;
    }
}

@media (max-width: 1024px) {
    .thumbnails-container {
        max-width: 460px;
    }
    
    .progress-container {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    #slider-container {
        min-height: 300px;
    }
    
    #right-thumbnails-area {
        width: 33.333%;
        position: fixed;
        bottom: min(100px, calc(var(--slider-height, 100vh) * 0.1));
        top: auto;
        left: auto;
        right: 20px;
        height: min(120px, calc(var(--slider-height, 100vh) * 0.12));
        max-width: 320px;
        padding: 10px;
        transform: none;
        flex-direction: column;
    }
    
    .thumbnail-nav-buttons {
        margin-bottom: 8px;
    }
    
    #thumbnails-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    #thumbnails-container {
        grid-template-columns: repeat(4, 80px);
        grid-template-rows: 1fr;
        gap: 8px;
    }
    
    .thumbnail-card {
        height: min(70px, calc(var(--slider-height, 100vh) * 0.07));
    }
    
    .thumbnails-container {
        max-width: 320px;
    }
    
    .progress-container {
        max-width: 100px;
    }
    
    .slide-counter {
        font-size: 24px;
    }
}

@media (max-width: 640px) {
    #slider-container {
        min-height: 250px;
    }
    
    #bottom-navigation-area {
        position: absolute;
        bottom: 10px;
        right: 10px;
        z-index: 15;
        padding: 16px 0;
        background-color: transparent;
        backdrop-filter: blur(5px);
        display: flex;
        width: auto;
        transform: none;
    }
    
    #right-thumbnails-area {
        position: fixed;
        bottom: min(60px, calc(var(--slider-height, 100vh) * 0.06));
        top: auto;
        left: 10px;
        right: 10px;
        width: auto;
        height: min(100px, calc(var(--slider-height, 100vh) * 0.1));
        max-width: none;
        padding: 8px;
        transform: none;
        flex-direction: row;
    }
    
    .thumbnail-nav-buttons {
        flex-direction: column;
        margin-right: 8px;
        padding: 4px;
    }
    
    .thumb-nav-btn {
        width: 28px;
        height: 28px;
        margin: 2px 0;
    }
    
    .thumb-page-indicator {
        font-size: 11px;
        margin: 4px 0;
    }
    
    #thumbnails-container {
        grid-template-columns: repeat(4, 80px);
        gap: 6px;
    }
    
    .thumbnail-card {
        height: min(60px, calc(var(--slider-height, 100vh) * 0.06));
    }
    
    .thumbnail-card-content h3 {
        font-size: 9px;
    }
    
    .thumbnail-card-title {
        font-size: 10px;
        padding-bottom: 10px;
        height: 25px;
    }
}

@media (max-width: 480px) {
    .thumbnails-container {
        max-width: 200px;
    }
    
    .progress-container {
        display: none;
    }
}

/* Touch optimization */
.thumbnail-card {
    -webkit-tap-highlight-color: transparent;
}

#thumbnails-container {
    -webkit-overflow-scrolling: touch;
}

/* Special handling for very small heights */
@media (max-height: 500px) {
    #slider-container {
        min-height: 400px;
    }
    
    #featured-text-content {
        bottom: 60px;
        padding: 1rem;
    }
    
    #featured-title {
        font-size: 1.5rem;
    }
    
    #featured-description {
        -webkit-line-clamp: 1;
    }
    
    #right-thumbnails-area {
        padding-top: 50px;
        transform: translatey(200px);
    }
}