/* -------------------------------------------------------------
   COMMON STYLE SYSTEM & VARIABLE DEFINITIONS
   ------------------------------------------------------------- */
:root {
    /* Default theme colors (Modern Slate & Violet Accent) */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-light: #f8fafc;
    --text-dark: #0f172a;
    --text-light: #f8fafc;
    --card-bg-light: #ffffff;
    --border-color: #e2e8f0;

    /* Customizable variables (overridden by localStorage/Admin settings via JS) */
    --page-bg-color: #0f172a;
    --welcome-btn-bg: #6366f1;
    --welcome-btn-text: #ffffff;
    --cta-btn-bg: #10b981;
    --cta-btn-text: #ffffff;
}

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

body {
    font-family: 'Kanit', 'Sarabun', sans-serif;
    background-color: var(--page-bg-color);
    color: var(--text-light);
    transition: background-color 0.4s ease;
    overflow-x: hidden;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* -------------------------------------------------------------
   LANDING PAGE STYLING (Premium Look)
   ------------------------------------------------------------- */

/* Header */
.header {
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-light);
    background: linear-gradient(135deg, #a78bfa, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 400;
    transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-light);
}

.nav-links a.admin-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    transition: all 0.3s ease;
}

.nav-links a.admin-btn:hover {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Hero Section */
.hero {
    position: relative;
    padding: 8rem 0 6rem 0;
    text-align: center;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    top: -10%;
    left: 50%;
    transform: translate(-50%, 0);
    width: 600px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 70%);
    z-index: 1;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    font-weight: 600;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.15rem;
    color: #94a3b8;
    margin-bottom: 2.5rem;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Features Grid */
.features {
    padding: 4rem 0 8rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title h2 {
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.section-title p {
    color: #94a3b8;
    font-size: 1rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateY(-5px);
}

.icon-wrapper {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: #94a3b8;
    font-size: 0.95rem;
}

/* Footer */
.footer {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: #64748b;
    font-size: 0.9rem;
}

/* -------------------------------------------------------------
   POPUP MODAL SYSTEM STYLE
   ------------------------------------------------------------- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px); /* Safari support */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 2rem;
}

/* Active Class for Modal Show */
.popup-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.popup-container {
    background: rgba(30, 41, 59, 0.85); /* Slate 800 with transparency */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 75vw;
    max-width: 1200px;
    max-height: 85vh;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.popup-overlay.show .popup-container {
    transform: scale(1);
}

/* Close Icon Button */
.popup-close-icon {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    font-weight: 300;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.popup-close-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: rotate(90deg);
}

/* Popup Body Content */
.popup-body {
    display: flex;
    flex-direction: column;
}

.popup-image-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #0f172a;
    position: relative;
    overflow: hidden;
}

.popup-image-wrapper img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

/* Hover Zoom effect if clickable image */
.popup-image-wrapper a {
    width: 100%;
    display: block;
    cursor: pointer;
}

.popup-image-wrapper a:hover img {
    transform: scale(1.03);
}

/* Buttons Section inside Modal */
.popup-footer {
    padding: 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: rgba(15, 23, 42, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* General style for popup buttons */
.popup-btn {
    width: 100%;
    padding: 0.9rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    outline: none;
}

/* Welcome Button (Main button requested) */
.popup-btn-welcome {
    background-color: var(--welcome-btn-bg);
    color: var(--welcome-btn-text);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.popup-btn-welcome:hover {
    filter: brightness(1.1);
    transform: translateY(-1.5px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

/* CTA Button (Action Button) */
.popup-btn-cta {
    background-color: var(--cta-btn-bg);
    color: var(--cta-btn-text);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.popup-btn-cta:hover {
    filter: brightness(1.1);
    transform: translateY(-1.5px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

/* Utility Hidden Class */
.hidden {
    display: none !important;
}

/* -------------------------------------------------------------
   CAROUSEL POPUP SYSTEM
   ------------------------------------------------------------- */

/* Slides Track — horizontal sliding container */
.popup-carousel-track {
    display: flex;
    width: 100%;
    transition: transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
}

.popup-carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

.popup-carousel-slide .popup-image-wrapper {
    width: 100%;
    /* Fixed aspect ratio ensures all slides have the same height */
    aspect-ratio: 16 / 9;
    max-height: 55vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #0f172a;
    position: relative;
    overflow: hidden;
}

/* Subtle vignette overlay for polished edges on cropped images */
.popup-carousel-slide .popup-image-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 70%,
        rgba(15, 23, 42, 0.25) 100%
    );
    pointer-events: none;
    z-index: 1;
}

.popup-carousel-slide .popup-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    transition: transform 0.5s ease;
}

.popup-carousel-slide .popup-image-wrapper a {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

.popup-carousel-slide .popup-image-wrapper a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.popup-carousel-slide .popup-image-wrapper a:hover img {
    transform: scale(1.03);
}

.popup-carousel-slide .popup-footer {
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: rgba(15, 23, 42, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    /* Footer always stays at consistent height */
    flex-shrink: 0;
}

/* Navigation Arrows */
.carousel-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-70%);
    z-index: 20;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.popup-overlay.show .carousel-nav-arrow {
    opacity: 1;
    pointer-events: auto;
}

.carousel-nav-arrow:hover {
    background: rgba(99, 102, 241, 0.6);
    border-color: rgba(99, 102, 241, 0.5);
    color: #ffffff;
    transform: translateY(-70%) scale(1.1);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.carousel-nav-arrow:active {
    transform: translateY(-70%) scale(0.95);
}

.carousel-nav-prev {
    left: -3.5rem;
}

.carousel-nav-next {
    right: -3.5rem;
}

/* Indicator Dots */
.carousel-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0 0.25rem 0;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.2);
}

.carousel-dot.active {
    background: var(--primary-color, #6366f1);
    border-color: rgba(99, 102, 241, 0.5);
    width: 28px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

/* Progress Bar */
.carousel-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 15;
    overflow: hidden;
}

.carousel-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #a78bfa);
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
}

.carousel-progress-fill.animating {
    animation: progressFill var(--carousel-duration, 5s) linear forwards;
}

@keyframes progressFill {
    from { width: 0%; }
    to { width: 100%; }
}

/* Slide Counter Badge */
.carousel-counter {
    position: absolute;
    top: 1rem;
    left: 1.2rem;
    z-index: 15;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'Sarabun', sans-serif;
    letter-spacing: 0.5px;
}

.carousel-counter i {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Carousel container needs overflow hidden and relative positioning */
.popup-container.carousel-mode {
    overflow: hidden;
    position: relative;
}

.popup-container.carousel-mode .popup-body {
    overflow: hidden;
    position: relative;
}

/* Pause indicator on hover */
.popup-container.carousel-mode:hover .carousel-progress-fill.animating {
    animation-play-state: paused;
}

.carousel-pause-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 25;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(6px);
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.3rem;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
    opacity: 0;
}

.popup-container.carousel-mode.is-paused .carousel-pause-hint {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Single popup — hide carousel controls */
.carousel-single .carousel-nav-arrow,
.carousel-single .carousel-indicators,
.carousel-single .carousel-counter,
.carousel-single .carousel-progress-bar {
    display: none !important;
}

/* -------------------------------------------------------------
   RESPONSIVE DESIGN ADAPTATIONS
   ------------------------------------------------------------- */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* simple hidden links for screen size on mockup demo */
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero {
        padding: 6rem 0 4rem 0;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .popup-container {
        width: 95%;
    }
    
    .popup-footer {
        padding: 1.25rem 1.5rem;
    }
    
    /* Carousel responsive */
    .carousel-nav-arrow {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 0.9rem;
    }
    
    .carousel-nav-prev {
        left: 0.5rem;
        top: 40%;
    }
    
    .carousel-nav-next {
        right: 0.5rem;
        top: 40%;
    }
    
    .carousel-counter {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    .carousel-dot {
        width: 8px;
        height: 8px;
    }
    
    .carousel-dot.active {
        width: 22px;
    }
    
    .popup-carousel-slide .popup-footer {
        padding: 1rem 1.25rem;
    }
}
