/* ========== 1. CSS Variables - Premium Design System ========== */
:root {
    --primary: #0a4d8c;
    --primary-dark: #042449;
    --primary-light: #e8f2fb;
    --secondary: #1e3a5f;
    --accent: #2563eb;
    --accent-light: #60a5fa;
    --gold: #d4af37;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --text: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --gradient-primary: linear-gradient(135deg, #0a4d8c 0%, #1e3a5f 100%);
    --gradient-accent: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
    --gradient-gold: linear-gradient(135deg, #d4af37 0%, #f59e0b 100%);
    
    /* ตัวแปรสำหรับขนาดตัวอักษร */
    --font-size-base: 16px;
    --font-size-h1: 3.5rem;
    --font-size-h2: 2rem;
    --font-size-h3: 1.5rem;
    --font-size-body: 1rem;
}

/* ขนาดตัวอักษร S */
body.font-size-s {
    --font-size-base: 14px;
    --font-size-h1: 2.8rem;
    --font-size-h2: 1.6rem;
    --font-size-h3: 1.2rem;
    --font-size-body: 0.9rem;
}

/* ขนาดตัวอักษร M (default) */
body.font-size-m {
    --font-size-base: 16px;
    --font-size-h1: 3.5rem;
    --font-size-h2: 2rem;
    --font-size-h3: 1.5rem;
    --font-size-body: 1rem;
}

/* ขนาดตัวอักษร L */
body.font-size-l {
    --font-size-base: 18px;
    --font-size-h1: 4.2rem;
    --font-size-h2: 2.4rem;
    --font-size-h3: 1.8rem;
    --font-size-body: 1.1rem;
}

body {
    font-size: var(--font-size-base);
    background: linear-gradient(180deg, var(--gray-50) 0%, var(--gray-100) 100%);
    font-family: 'Prompt', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
}

.hero-title { font-size: var(--font-size-h1); }
.section-title { font-size: var(--font-size-h2); }
.card-header-premium h3 { font-size: var(--font-size-h3); }
p, .hero-subtitle, .card-description, .trust-text, .card-header-premium p { font-size: var(--font-size-body); }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-up { animation: fadeInUp 0.8s ease forwards; }
.animate-fade-left { animation: fadeInLeft 0.8s ease forwards; }
.animate-fade-right { animation: fadeInRight 0.8s ease forwards; }
.animate-scale { animation: scaleIn 0.6s ease forwards; }
.animate-slide-down { animation: slideInDown 0.7s ease forwards; }

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

.scroll-reveal { opacity: 0; transform: translateY(30px); transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.scroll-reveal.revealed { opacity: 1; transform: translateY(0); }

.scroll-reveal-left { opacity: 0; transform: translateX(-30px); transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.scroll-reveal-left.revealed { opacity: 1; transform: translateX(0); }

.scroll-reveal-right { opacity: 0; transform: translateX(30px); transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.scroll-reveal-right.revealed { opacity: 1; transform: translateX(0); }

.scroll-reveal-scale { opacity: 0; transform: scale(0.95); transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.scroll-reveal-scale.revealed { opacity: 1; transform: scale(1); }

body, h1, h2, h3, h4, h5, h6, p, span, div, a, button, input, textarea, .card, .btn, .section-title, .hero-title, .hero-subtitle, .stat-number, .stat-label, .trust-text, .btn-premium {
    font-family: 'Prompt', 'Inter', system-ui, -apple-system, sans-serif !important;
}

/* ========== BACKGROUND ========== */
.main-wrapper {
    position: relative;
    overflow-x: hidden;
}

.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: 0;
    pointer-events: none;
}

.bg-orb-1 { width: 500px; height: 500px; background: radial-gradient(circle, var(--accent-light), transparent); top: -200px; right: -100px; }
.bg-orb-2 { width: 600px; height: 600px; background: radial-gradient(circle, var(--primary-light), transparent); bottom: -200px; left: -150px; }
.bg-orb-3 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(212, 175, 55, 0.3), transparent); top: 40%; right: 20%; }

/* Caption สไลด์แบบเดิม */
.carousel-caption {
    background: rgba(0, 0, 0, 0.6) !important; 
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    padding: 12px 15px !important; 
    font-family: 'Prompt', sans-serif !important;
}

/* ========== HERO SECTION ========== */
.hero-section {
    position: relative;
    background: var(--gradient-primary);
    padding: 100px 0 120px;
    overflow: hidden;
    z-index: 1;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.05)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,154.7C960,171,1056,181,1152,165.3C1248,149,1344,107,1392,85.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') repeat-x bottom;
    background-size: cover;
    opacity: 0.5;
    pointer-events: none;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0; right: 0;
    height: 100px;
    background: linear-gradient(to top, var(--gray-50), transparent);
    z-index: 2;
}

.hero-floating {
    position: absolute;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.08), transparent);
    border-radius: 50%;
    top: -150px; left: -100px;
    animation: float 20s infinite ease-in-out;
}

.hero-floating-2 {
    position: absolute;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.05), transparent);
    border-radius: 50%;
    bottom: -80px; right: 10%;
    animation: float 15s infinite ease-in-out reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(30px, 20px) rotate(5deg); }
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    backdrop-filter: blur(2px);
}

.hero-title {
    font-weight: 800;
    line-height: 1.2;
    color: var(--white);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
    font-family: 'Prompt', sans-serif !important;
}

.hero-title span {
    background: linear-gradient(135deg, var(--accent-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: rgba(255,255,255,0.85);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 48px;
    flex-wrap: wrap;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gold);
    display: block;
}

.stat-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========== CONTENT SECTION ========== */
.content-section {
    position: relative;
    padding: 60px 0 80px;
    z-index: 2;
}

.content-section .container-fluid {
    max-width: 100%;
    padding-left: 30px;
    padding-right: 30px;
}

.content-section .row {
    display: flex;
    flex-wrap: wrap; /* เปลี่ยนจาก nowrap เป็น wrap เพื่อให้มือถือลงมาต่อกัน */
    margin-left: -15px;
    margin-right: -15px;
}

.content-section .col-lg-4 {
    padding-left: 15px;
    padding-right: 15px;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-title {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    display: block;
}

.section-divider {
    height: 4px;
    background: var(--gradient-accent);
    margin: 0 auto;
    border-radius: 4px;
    width: 200px;
}

/* Premium Cards */
.premium-card {
    background: var(--white);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    height: 100%;
    position: relative;
}

.premium-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gradient-accent);
    z-index: 1;
}

.premium-card.card-1::before { background: var(--gradient-primary); }
.premium-card.card-2::before { background: linear-gradient(135deg, #059669, #10b981); }
.premium-card.card-3::before { background: var(--gradient-gold); }

.premium-card:hover {
    transform: translateY(-12px);
    box-shadow: var(--shadow-2xl);
}

.card-header-premium {
    padding: 24px 28px 16px;
    position: relative;
}

.card-header-premium h3 {
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.card-header-premium p {
    color: var(--text-light);
    margin-top: 4px;
}

/* Modern Carousel */
.modern-carousel {
    position: relative;
    overflow: hidden;
}

.carousel-image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.modern-carousel .carousel-inner {
    border-radius: 0;
}

.modern-carousel .carousel-item img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.modern-carousel .carousel-item:hover img {
    transform: scale(1.05);
}

.carousel-caption-premium {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    padding: 30px 20px 16px;
    text-align: left;
}

.carousel-caption-premium h5 {
    color: var(--white);
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    line-height: 1.4;
}

.carousel-control-custom {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
    box-shadow: var(--shadow-md);
    z-index: 5;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
}

.modern-carousel:hover .carousel-control-custom { opacity: 1; }
.carousel-control-custom:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-50%) scale(1.1);
}

.carousel-control-prev-custom { left: 16px; }
.carousel-control-next-custom { right: 16px; }

.carousel-indicators-custom {
    position: absolute;
    bottom: 12px;
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 5;
}

.carousel-indicators-custom li {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: var(--transition);
    list-style: none;
}

.carousel-indicators-custom li.active {
    width: 24px;
    border-radius: 4px;
    background: var(--accent-light);
}

/* Card Footer */
.card-footer-premium {
    padding: 20px 28px 28px;
    text-align: center;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 60px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    font-size: var(--font-size-body);
}

.btn-premium:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.btn-premium-2 { border-color: #059669; color: #059669; }
.btn-premium-2:hover { background: #059669; color: var(--white); }

/* ========== TRUST STRIP ========== */
.trust-strip {
    background: var(--white);
    padding: 40px 0;
    margin-top: 40px;
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 70px;
}

.trust-icon {
    width: 48px; height: 48px;
    background: transparent;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trust-icon img {
    width: 32px; height: 32px;
    object-fit: contain;
}

.trust-text {
    font-weight: 600;
    color: var(--gray-700);
    word-break: break-word; /* ปรับจาก nowrap เพื่อให้ในจอมือถือไม่ล้น */
}

.trust-text small {
    display: block;
    font-weight: 400;
    color: var(--gray-500);
    font-size: 0.75rem;
}

/* ========== RESPONSIVE MOBILE FIXES ========== */
@media (min-width: 1200px) {
    .content-section .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

@media (max-width: 1199px) {
    .content-section .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 30px;
    }
}

@media (max-width: 991px) {
    .hero-section { padding: 60px 0 80px; }
    .trust-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .carousel-control-custom { opacity: 1; width: 38px; height: 38px; font-size: 20px; }
    .carousel-image-wrapper { aspect-ratio: 16/10; }
}

@media (max-width: 767px) {
    .hero-title {
        white-space: normal !important; /* ยอมให้ตัดบรรทัดเฉพาะมือถือ เพื่อไม่ให้หน้าจอล้น */
    }
    .content-section .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    .trust-grid { grid-template-columns: 1fr; gap: 15px; }
    .trust-item { min-height: auto; }
    
}