@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ==========================================================================
   1. PREMIUM DESIGN SYSTEM & RESET
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Kanit', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

:root {
    --bg-color: #000000;
    --surface-color: #050505;
    --surface-card: #0d0d0f;
    --surface-card-hover: #141417;
    --text-main: #ffffff;
    --text-muted: #a0a0ab;
    --border-color: #1f1f23;
    --accent-color: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.05);
    --success-color: #34c759;
    --easing: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-speed: 0.4s;
    --max-width: 1200px;
    
    /* Premium tech styles */
    --primary-color: #0071e3;
    --primary-hover: #0051a8;
    --primary-gradient: linear-gradient(135deg, #00f0ff 0%, #0071e3 100%);
    --primary-shadow: rgba(0, 113, 227, 0.3);
    --primary-shadow-hover: rgba(0, 113, 227, 0.45);
}

[data-theme="light"] {
    --bg-color: #f5f5f7;
    --surface-color: #ffffff;
    --surface-card: #fdfdfd;
    --surface-card-hover: #f5f5f7;
    --text-main: #1d1d1f;
    --text-muted: #6e6e73;
    --border-color: #e5e5ea;
    --accent-color: #000000;
    --accent-glow: rgba(0, 0, 0, 0.02);
    
    /* Premium tech styles - Light Theme */
    --primary-color: #0071e3;
    --primary-hover: #0051a8;
    --primary-gradient: linear-gradient(135deg, #00bfff 0%, #0071e3 100%);
    --primary-shadow: rgba(0, 113, 227, 0.15);
    --primary-shadow-hover: rgba(0, 113, 227, 0.25);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color var(--transition-speed) var(--easing), 
                color var(--transition-speed) var(--easing);
}

.container {
    width: 90%;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: transform 0.8s var(--easing), opacity 0.8s var(--easing);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   2. NAVIGATION HEADER
   ========================================================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-speed) var(--easing), 
                border-color var(--transition-speed) var(--easing);
}

[data-theme="light"] header {
    background: rgba(245, 245, 247, 0.75);
}

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

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
}

.logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    transition: filter var(--transition-speed) var(--easing);
}

[data-theme="light"] .logo-img {
    filter: invert(1);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.7;
    position: relative;
    padding: 6px 0;
    transition: opacity 0.3s var(--easing), color 0.3s var(--easing);
}

.nav-links a:hover,
.nav-links a.active {
    opacity: 1;
    color: var(--primary-color);
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 12px;
    height: 2px;
    border-radius: 2px;
    background: var(--primary-color);
    transition: transform 0.3s var(--easing);
    transform-origin: center;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    transform: translateX(-50%) scaleX(1);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s var(--easing);
}

.theme-toggle:hover {
    background: var(--border-color);
    border-color: var(--text-main);
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    fill: none;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-main);
    margin: 4px 0;
    transition: 0.3s;
}

/* ==========================================================================
   3. SECTIONS & BUTTONS GENERAL
   ========================================================================== */
section {
    padding: 100px 0;
    border-bottom: 1px solid var(--border-color);
}

.section-header {
    margin-bottom: 60px;
    max-width: 700px;
}

.section-header h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 15px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.tagline {
    display: inline-block;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 25px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: var(--surface-color);
    color: var(--text-muted);
}

.cta-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s var(--easing);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 15px var(--primary-shadow);
}

.btn-primary:hover {
    background: var(--primary-gradient);
    filter: brightness(1.1);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-shadow-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

[data-theme="light"] .btn-secondary {
    background: rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--text-main);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* ==========================================================================
   4. CARDS & GRID COMPONENTS
   ========================================================================== */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 30px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 40px;
}

.card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--easing);
}

.card:hover {
    border-color: var(--primary-color);
    background: var(--surface-card-hover);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 113, 227, 0.08);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 20px;
    display: inline-block;
}

.tech-icon {
    width: 32px;
    height: 32px;
    color: var(--text-main);
    display: inline-block;
    vertical-align: middle;
    transition: color 0.3s var(--easing);
}

.card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 25px;
    border-bottom: 1px solid transparent;
    transition: border var(--transition-speed);
}

.card-link:hover {
    border-color: var(--text-main);
}

/* ==========================================================================
   5. FORMS & INPUTS
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--text-main);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

[data-theme="light"] select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23000000' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-status {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: none;
}

.form-status.success {
    display: block;
    background: rgba(52, 199, 89, 0.1);
    border: 1px solid var(--success-color);
    color: #34c759;
}

.form-status.error {
    display: block;
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid #ff453a;
    color: #ff453a;
}

/* ==========================================================================
   6. FOOTER
   ========================================================================== */
footer {
    background: var(--surface-color);
    padding: 80px 0 40px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 50px;
    margin-bottom: 50px;
}

.footer-brand p {
    margin-top: 15px;
    max-width: 320px;
    line-height: 1.6;
}

.footer-links-group h4 {
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s var(--easing);
}

.footer-links a:hover {
    color: var(--text-main);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-legal {
    display: flex;
    gap: 20px;
}

.footer-legal a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-legal a:hover {
    color: var(--text-main);
}

/* ==========================================================================
   7. PRELOADER SCREEN
   ========================================================================== */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #050505;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 1.0s cubic-bezier(0.85, 0, 0.15, 1), opacity 0.8s;
}

[data-theme="light"] #preloader {
    background-color: #f5f5f7;
}

.preloader-logo {
    width: 70px;
    height: auto;
    animation: preloader-pulse 1.8s infinite ease-in-out;
}

[data-theme="light"] .preloader-logo {
    filter: invert(1);
}

@keyframes preloader-pulse {
    0%, 100% { transform: scale(0.95); opacity: 0.6; }
    50% { transform: scale(1.05); opacity: 1; }
}

@keyframes loading-bar {
    0% { left: -50px; }
    100% { left: 100px; }
}

.preloader-hidden {
    transform: translateY(-100%) !important;
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   8. FLOATING LINE CHATBOT WIDGET
   ========================================================================== */
#floating-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: inherit;
}

#chat-widget-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06C755 0%, #05a647 100%);
    border: none;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(6, 199, 85, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    transition: transform 0.25s var(--easing), box-shadow 0.25s;
}

#chat-widget-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 30px rgba(6, 199, 85, 0.5);
}

.chat-trigger-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(6, 199, 85, 0.4);
    top: 0;
    left: 0;
    z-index: -1;
    animation: trigger-ripple 2s infinite ease-out;
}

@keyframes trigger-ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

#chat-window-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 330px;
    height: 480px;
    background: rgba(20, 20, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 9;
}

[data-theme="light"] #chat-window-container {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

@keyframes slideUp {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.chat-window-header {
    background: #06C755;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
}

.chat-window-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-brand-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-brand-details h5 {
    font-size: 0.85rem;
    font-weight: 600;
}

.chat-status-dot {
    font-size: 0.65rem;
    opacity: 0.9;
}

#chat-window-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#chat-window-close:hover {
    opacity: 1;
}

.chat-window-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-options-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.chat-option-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.75rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

[data-theme="light"] .chat-option-item {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.05);
}

.chat-option-item:hover {
    background: rgba(6, 199, 85, 0.1);
    border-color: #06C755;
    transform: translateX(4px);
}

.chat-window-footer {
    padding: 12px 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.1);
    gap: 10px;
}

.chat-input-placeholder {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-grow: 1;
}

.chat-send-btn {
    background: #06C755;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.chat-send-btn:hover {
    opacity: 0.9;
}

/* ==========================================================================
   9. GLOBAL RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
    .container {
        width: 92%;
    }
}

@media (max-width: 768px) {
    section {
        padding: 70px 0;
    }
    
    .navbar {
        padding: 12px 0;
    }
    
    .logo-area {
        gap: 8px;
        font-size: 1.15rem;
    }
    
    .logo-img {
        height: 28px;
    }
    
    .mobile-nav-toggle {
        display: block;
        z-index: 1001;
    }
    
    .mobile-nav-active .mobile-nav-toggle span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    
    .mobile-nav-active .mobile-nav-toggle span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-nav-active .mobile-nav-toggle span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 75%;
        max-width: 300px;
        height: 100vh;
        background: var(--surface-color);
        border-left: 1px solid var(--border-color);
        flex-direction: column;
        justify-content: center;
        gap: 40px;
        transition: right 0.4s var(--easing);
        z-index: 999;
    }
    
    .mobile-nav-active .nav-links {
        right: 0;
    }
    
    .nav-links a {
        font-size: 1.1rem;
    }
    
    .nav-links a::after {
        display: none; /* Hide slide underlining on mobile menu */
    }
    
    .cta-group {
        justify-content: center;
        flex-direction: column;
        gap: 12px;
    }
    
    .btn {
        width: 100%;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        width: 94%;
    }
    
    .logo-area span {
        font-size: 1.05rem;
    }
    
    .logo-img {
        height: 24px;
    }
    
    #floating-chat-widget {
        bottom: 20px;
        right: 20px;
    }
    #chat-window-container {
        width: calc(100vw - 40px);
        max-width: 330px;
    }
}
