/* ----------------------------------------------- */
/* --- BASIC SETUP & VARIABLES ------------------- */
/* ----------------------------------------------- */
:root {
    --primary-color: #007bff;
    --secondary-color: #0056b3;
    --accent-color: #ff6b35;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --success-color: #28a745;
    --text-color: #555;
    --font-primary: 'Sarabun', sans-serif;
    --font-secondary: 'Poppins', sans-serif;
    --gradient-primary: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    --gradient-accent: linear-gradient(135deg, #ff6b35 0%, #f72b1c 100%);
    --shadow-light: 0 5px 15px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 15px 35px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fff;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-bg {
    background-color: var(--light-color);
    position: relative;
}

.section-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23007bff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: 0;
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    z-index: 1;
}

.section-title h2 {
    font-family: var(--font-secondary);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.section-title h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.section-title p {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 20px auto 0;
}

/* ----------------------------------------------- */
/* --- PRELOADER -------------------------------- */
/* ----------------------------------------------- */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 123, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    position: relative;
}

.spinner::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 3px solid transparent;
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.6s ease-in-out infinite reverse;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ----------------------------------------------- */
/* --- HEADER & NAVIGATION ----------------------- */
/* ----------------------------------------------- */
.header {
    background-color: #fff;
    box-shadow: var(--shadow-light);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: var(--transition);
    backdrop-filter: none;
}

.header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-medium);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.nav-logo {
    font-family: var(--font-secondary);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.nav-logo:hover {
    transform: scale(1.05);
}

.nav-logo i {
    margin-right: 10px;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.nav-menu {
    display: flex;
    list-style: none;
}

.nav-item {
    margin-left: 30px;
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    padding: 5px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link:hover {
    color: var(--primary-color);
}

.hamburger {
    display: none;
    cursor: pointer;
    width: 30px;
    height: 30px;
    position: relative;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
    background-color: var(--dark-color);
    position: absolute;
    left: 0;
}

.bar:nth-child(1) {
    top: 5px;
}

.bar:nth-child(2) {
    top: 13px;
}

.bar:nth-child(3) {
    top: 21px;
}

/* ----------------------------------------------- */
/* --- HERO SECTION ------------------------------ */
/* ----------------------------------------------- */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://prapananservice.page.gd/image/nan.jpg') no-repeat center center/cover;
    height: 100vh;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(0, 123, 255, 0.2) 0%, rgba(0, 0, 0, 0.6) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero-content h1 {
    font-family: var(--font-secondary);
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 1s ease;
}

.hero-subtitle {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 30px;
    animation: fadeInUp 1s ease 0.2s;
    animation-fill-mode: both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----------------------------------------------- */
/* --- BUTTONS ----------------------------------- */
/* ----------------------------------------------- */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    z-index: -1;
    transition: transform 0.3s ease;
    transform: scaleX(0);
    transform-origin: left;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary::before {
    background: var(--gradient-primary);
}

.btn-primary:hover::before {
    transform: scaleX(1);
}

.btn-primary:hover {
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.btn-full {
    display: block;
    width: 100%;
    text-align: center;
}

/* ----------------------------------------------- */
/* --- SERVICES SECTION -------------------------- */
/* ----------------------------------------------- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    background: white;
    padding: 40px 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.service-card:hover::before {
    transform: scaleX(1);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
}

.service-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: var(--transition);
}

.service-card:hover .service-icon {
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(0, 123, 255, 0.3);
}

.service-card h3 {
    font-family: var(--font-secondary);
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--dark-color);
    transition: var(--transition);
}

.service-card:hover h3 {
    color: var(--primary-color);
}

/* ----------------------------------------------- */
/* --- WHY US SECTION ---------------------------- */
/* ----------------------------------------------- */
.why-us-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.why-us-item {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.why-us-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: var(--gradient-primary);
    opacity: 0.1;
    transition: height 0.3s ease;
}

.why-us-item:hover::after {
    height: 100%;
}

.why-us-item:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
}

.why-us-icon {
    background: var(--gradient-primary);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem;
    transition: var(--transition);
}

.why-us-item:hover .why-us-icon {
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(0, 123, 255, 0.3);
}

.why-us-item h4 {
    font-family: var(--font-secondary);
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--dark-color);
    transition: var(--transition);
}

.why-us-item:hover h4 {
    color: var(--primary-color);
}

/* ----------------------------------------------- */
/* --- PORTFOLIO SECTION ------------------------- */
/* ----------------------------------------------- */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.portfolio-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.portfolio-item:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
}

.portfolio-img img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 123, 255, 0.8), rgba(0, 86, 179, 0.8));
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-item:hover .portfolio-img img {
    transform: scale(1.1);
}

.portfolio-overlay h4 {
    font-family: var(--font-secondary);
    font-size: 1.5rem;
    margin-bottom: 10px;
    transform: translateY(20px);
    transition: transform 0.3s ease 0.1s;
}

.portfolio-overlay p {
    transform: translateY(20px);
    transition: transform 0.3s ease 0.2s;
}

.portfolio-item:hover .portfolio-overlay h4,
.portfolio-item:hover .portfolio-overlay p {
    transform: translateY(0);
}

/* ----------------------------------------------- */
/* --- TESTIMONIALS SECTION ---------------------- */
/* ----------------------------------------------- */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.testimonial-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
    position: relative;
    transition: var(--transition);
}

.testimonial-card::before {
    content: '"';
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 4rem;
    color: rgba(0, 123, 255, 0.1);
    font-family: Georgia, serif;
}

.testimonial-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
}

.testimonial-card p {
    font-style: italic;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.testimonial-card h4 {
    font-family: var(--font-secondary);
    color: var(--dark-color);
    margin-bottom: 5px;
}

.testimonial-card span {
    color: #888;
    font-size: 0.9rem;
}

.testimonial-rating {
    color: #ffc107;
    margin-top: 10px;
}

/* ----------------------------------------------- */
/* --- FAQ SECTION ------------------------------- */
/* ----------------------------------------------- */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background-color: white;
    border-radius: 15px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.faq-item:hover {
    box-shadow: var(--shadow-medium);
}

.faq-question {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
    position: relative;
}

.faq-question::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    width: calc(100% - 40px);
    height: 1px;
    background-color: rgba(0, 0, 0, 0.05);
}

.faq-question:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.faq-question h4 {
    margin: 0;
    color: var(--dark-color);
    font-family: var(--font-secondary);
    font-size: 1.1rem;
}

.faq-question i {
    color: var(--primary-color);
    transition: transform 0.3s ease;
    font-size: 1.2rem;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
    padding: 0 20px 20px;
}

.faq-answer p {
    margin: 0;
    color: var(--text-color);
}

/* ----------------------------------------------- */
/* --- CONTACT SECTION --------------------------- */
/* ----------------------------------------------- */
.contact-container {
    display: flex;
    gap: 50px;
    align-items: flex-start;
}

.contact-info {
    flex: 1;
}

.contact-form {
    flex: 1;
}

.contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: white;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.contact-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.contact-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-right: 20px;
    width: 30px;
    text-align: center;
}

.contact-item h4 {
    font-family: var(--font-secondary);
    font-size: 1.1rem;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.contact-item a, .contact-item p {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.contact-item a:hover {
    color: var(--primary-color);
}

.contact-form {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 15px;
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* ----------------------------------------------- */
/* --- FOOTER ------------------------------------ */
/* ----------------------------------------------- */
#footer {
    background-color: var(--dark-color);
    color: #fff;
    padding: 40px 0;
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.social-links a {
    color: #fff;
    font-size: 1.5rem;
    margin-left: 15px;
    transition: var(--transition);
    position: relative;
}

.social-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.social-links a:hover::after {
    width: 100%;
}

.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* ----------------------------------------------- */
/* --- FLOATING BUTTONS -------------------------- */
/* ----------------------------------------------- */
.floating-call-btn, .floating-line-btn {
    position: fixed;
    bottom: 30px;
    width: 65px; /* เพิ่มขนาดเล็กน้อย */
    height: 65px; /* เพิ่มขนาดเล็กน้อย */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 26px; /* เพิ่มขนาดไอคอน */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* ใช้ transition ที่น่าสนใจขึ้น */
    text-decoration: none;
}

/* สร้างเอฟเฟกต์เปล่งแสง (Glow Effect) ด้วย ::before */
.floating-call-btn::before, .floating-line-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    z-index: -1;
    opacity: 0.4;
    filter: blur(12px);
    transition: all 0.4s ease;
}

.floating-call-btn {
    right: 30px;
    background: linear-gradient(45deg, #25d366, #128C7E); /* ใช้สีเขียวของ LINE สำหรับปุ่มโทรเพื่อความสม่ำเสมอ */
}

.floating-line-btn {
    right: 105px; /* ปรับระยะห่าง */
    background: linear-gradient(45deg, #00C300, #128C7E); /* ไล่เฉดสีเขียว */
}

/* เพิ่มอนิเมชันเมื่อชี้เมาส์ (Hover) */
.floating-call-btn:hover, .floating-line-btn:hover {
    transform: scale(1.15) rotate(5deg); /* ขยายและหมุนเล็กน้อย */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.floating-call-btn:hover::before, .floating-line-btn:hover::before {
    opacity: 0.6;
    filter: blur(15px);
}

/* --- อนิเมชันสำหรับให้ปุ่มโดดเด่น --- */

/* อนิเมชันกระตุก (Wiggle) เมื่อโหลดหน้าเว็บเสร็จ */
@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

/* อนิเมชันเต้น (Pulse) ซ้ำๆ เพื่อดึงดูดสายตา */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 195, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(0, 195, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 195, 0, 0);
    }
}

/* คลาสสำหรับเรียกใช้อนิเมชันผ่าน JavaScript */
.floating-btn-wiggle {
    animation: wiggle 1.5s ease-in-out;
}

/* ให้ปุ่ม LINE มีอนิเมชัน Pulse ตลอดเวลา */
.floating-line-btn {
    animation: pulse 2s infinite;
}

/* ----------------------------------------------- */
/* --- RESPONSIVE DESIGN ------------------------- */
/* ----------------------------------------------- */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        top: 13px;
        transform: rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        top: 13px;
        transform: rotate(-45deg);
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: #fff;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-medium);
        padding: 20px 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        margin: 15px 0;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .section-title h2 {
        font-size: 2rem;
    }

    .contact-container {
        flex-direction: column;
    }

    .footer-content {
        flex-direction: column;
        gap: 20px;
    }

    /* --- ปรับปรุงปุ่มลอยสำหรับมือถือ --- */
    .floating-call-btn, .floating-line-btn {
        width: 55px; /* ลดขนาดจาก 65px เป็น 55px */
        height: 55px; /* ลดขนาดจาก 65px เป็น 55px */
        font-size: 22px; /* ลดขนาดไอคอนจาก 26px เป็น 22px */
        bottom: 20px; /* ปรับตำแหน่งให้ชิดขอบล่างมากขึ้น */
    }

    .floating-call-btn {
        right: 20px; /* ชิดขอบขวา */
    }

    .floating-line-btn {
        right: 20px; /* ชิดขอบขวา */
        bottom: 85px; /* วางซ้อนกับปุ่มโทร โดยเว้นระยะห่าง 10px (55px + 10px + 20px) */
    }

    /* ปรับเอฟเฟกต์เปล่งแสงให้เล็กลงบนมือถือ */
    .floating-call-btn::before, .floating-line-btn::before {
        filter: blur(8px); /* ลดความเบลอจาก 12px เป็น 8px */
    }

    .floating-call-btn:hover::before, .floating-line-btn:hover::before {
        filter: blur(10px); /* ลดความเบลอจาก 15px เป็น 10px */
    }
}