/* ================================
   📄 assets/css/responsive.css
   DD.COM HuaHin - Responsive Styles
   ================================ */

.mobile-fixed-bottom-nav {
    display: none;
}

/* ================================
   DESKTOP DEFAULT (>=1025px)
   — บังคับ 3 คอลัมน์บนเดสก์ท็อปทั่วไป
   ================================ */
@media (min-width: 1025px) {
    .services-grid,
    .about-grid,
    .portfolio-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
}

/* ================================
   LARGE SCREENS (min-width: 1400px)
   ================================ */

@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
    
    .hero h1 {
        font-size: 4.2rem;
    }
    
    .section-title h2 {
        font-size: 3.2rem;
    }
    
    .services-grid,
    .about-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 40px;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 40px;
    }
    
    .process-steps {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ================================
   TABLET STYLES (768px - 1024px)
   ================================ */

@media (max-width: 1024px) {
    
    /* Header Adjustments */
    .header-container {
        flex-wrap: wrap;
    }
    
    /* Hero Section */
    .hero h1 {
        font-size: 3.2rem;
    }
    
    .hero p {
        font-size: 1.2rem;
    }
    
    /* Section Titles */
    .section-title h2 {
        font-size: 2.5rem;
    }
    
    /* Grids */
    .services-grid,
    .about-grid,
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 25px;
    }
    
    .process-steps {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    /* Contact Section */
    .contact-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .contact-form {
        padding: 40px 30px;
    }
    
    /* Footer */
    .footer-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 30px;
    }
    
    /* Service Cards */
    .service-icon {
        height: 120px;
        font-size: 3rem;
    }
    
    /* About Cards */
    .about-card {
        padding: 35px 25px;
    }
    
    .highlight-number {
        font-size: 3rem;
    }
}

/* ================================
   MOBILE STYLES (max-width: 768px)
   ================================ */

@media (max-width: 768px) {
    /* Header Mobile */
    .mobile-menu-toggle {
        display: block;
        order: 3;
    }
    
    /* Language Switcher Mobile */
    .language-switcher {
        order: 2;
        margin-left: auto;
        margin-right: 10px;
    }
    
    .lang-toggle {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .lang-menu {
        right: 0;
        min-width: 130px;
    }
    
    .lang-option {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .flag-icon {
        width: 18px;
        height: 13px;
    }
    
    nav {
        order: 4;
        width: 100%;
    }
    
    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(248, 87, 166, 0.98);
        padding: 25px;
        border-radius: 0 0 25px 25px;
        backdrop-filter: blur(15px);
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        gap: 5px;
        z-index: 1000;
    }
    
    nav ul.show {
        display: flex;
    }
    
    nav ul li {
        margin: 0;
        width: 100%;
    }
    
    nav ul li a {
        padding: 15px 20px;
        border-radius: 15px;
        display: block;
        text-align: center;
        width: 100%;
    }
    
    .header-container {
        position: relative;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .logo {
        order: 1;
        flex: 1;
    }
    
    .cta-button {
        order: 2;
        font-size: 0.9rem;
        padding: 10px 20px;
        display: none; /* Hide on mobile to save space */
    }
    
    /* Hero Mobile */
    .hero {
        padding: 120px 0 80px;
        min-height: 90vh;
    }
    
    .hero-bg-1,
    .hero-bg-2 {
        background-position: center center;
        background-size: cover;
    }
    
    .hero h1 {
        font-size: 2.2rem;
        margin-bottom: 20px;
        line-height: 1.3;
        text-shadow: 2px 2px 6px rgba(0,0,0,0.7);
    }
    
    .hero p {
        font-size: 1rem;
        margin-bottom: 30px;
        text-shadow: 1px 1px 4px rgba(0,0,0,0.7);
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
        text-align: center;
        padding: 16px 30px;
        font-size: 1rem;
    }
    
    /* Sections Mobile */
    section {
        padding: 60px 0;
    }
    
    .section-title {
        margin-bottom: 40px;
    }
    
    .section-title h2 {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .section-title p {
        font-size: 1rem;
    }
    
    /* Grid Mobile */
    .services-grid,
    .about-grid,
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 40px;
    }
    
    .process-steps {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    /* Cards Mobile */
    .service-card,
    .about-card,
    .portfolio-item {
        margin: 0;
        max-width: 400px;
    }
    
    .service-content,
    .about-card,
    .portfolio-content {
        padding: 25px 20px;
    }
    
    .service-icon {
        height: 120px;
        font-size: 3rem;
    }
    
    .about-icon {
        font-size: 3.5rem;
    }
    
    .highlight-number {
        font-size: 3rem;
    }
    
    /* Portfolio Mobile */
    .portfolio-filter {
        gap: 10px;
        margin: 30px 0 40px;
        justify-content: center;
    }
    
    .filter-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
        flex: 1;
        min-width: auto;
        max-width: 120px;
    }
    
    .portfolio-image {
        height: 220px;
        font-size: 3.5rem;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    /* Process Mobile */
    .step {
        padding: 40px 20px 30px;
    }
    
    .step-number {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
        margin: -35px auto 25px;
    }
    
    /* Contact Mobile */
    .contact {
        padding: 60px 0;
    }
    
    .contact-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .contact-info h2 {
        font-size: 2.2rem;
        margin-bottom: 20px;
    }
    
    .contact-item {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .contact-icon {
        width: 60px;
        height: 60px;
        margin: 0 0 15px 0;
    }
    
    .contact-form {
        padding: 30px 20px;
    }
    
    .contact-form h3 {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }
    
    .form-control {
        padding: 15px 18px;
    }
    
    .submit-btn {
        padding: 16px 30px;
        font-size: 1rem;
    }
    
    /* Map Mobile */
    .map-container {
        height: 300px;
        border-radius: 15px;
    }
    
    /* Footer Mobile */
    footer {
        padding: 60px 0 20px;
    }
    
    .footer-container {
        grid-template-columns: 1fr;
        gap: 30px;
        margin-bottom: 30px;
        text-align: center;
    }
    
    .footer-logo {
        font-size: 1.6rem;
        justify-content: center;
    }
    
    .footer-about {
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .social-links a {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .footer-title {
        text-align: center;
        font-size: 1.2rem;
    }
    
    .footer-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-links ul li a {
        justify-content: center;
        padding: 8px 0;
    }
    
    .copyright {
        margin: 30px -20px -20px;
        padding: 25px 20px;
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    /* Back to Top Mobile */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    /* Utility Classes Mobile */
    .hide-mobile { 
        display: none !important; 
    }
    
    .show-mobile { 
        display: block !important; 
    }

    .footer-container {
        grid-template-columns: 1fr;
    }

    /* =========================================
       ✨ MOBILE FIXED BOTTOM NAV WITH ANIMATION
       ========================================= */

    /* 1. สร้าง Keyframe สำหรับเด้งเลื่อนขึ้นมาตอนเปิดเว็บ */
    @keyframes slideUpNav {
        0% {
            transform: translateY(100%);
            opacity: 0;
        }
        100% {
            transform: translateY(0);
            opacity: 1;
        }
    }

/* ... โค้ดด้านบนของ @media (max-width: 768px) ยังเหมือนเดิม ... */

    .mobile-fixed-bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, 1fr); /* เปลี่ยนจาก 4 เป็น 5 คอลัมน์ */
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 9999;
        background: #ffffff;
        box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.12);
        padding-bottom: env(safe-area-inset-bottom);
        font-family: 'Kanit', sans-serif;
        
        opacity: 0;
        animation: slideUpNav 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        animation-delay: 0.2s;
    }

    .mobile-fixed-bottom-nav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 10px 2px; /* ลด padding ด้านข้างลงนิดหน่อยเพื่อให้มีพื้นที่ */
        min-height: 64px;
        color: #2a2a2a;
        text-decoration: none;
        text-align: center;
        -webkit-tap-highlight-color: transparent;
        outline: none !important; /* ปิดกรอบ outline สีชมพู */
    }

    /* ปิดกรอบ outline ตอนที่กดปุ่มด้วย */
    .mobile-fixed-bottom-nav__item:focus,
    .mobile-fixed-bottom-nav__item:active {
        outline: none !important;
    }

    .mobile-fixed-bottom-nav__icon {
        font-size: 1.25rem;
        line-height: 1;
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.2s ease;
    }

    .mobile-fixed-bottom-nav__label {
        font-size: 0.65rem; /* ปรับขนาดเล็กลงนิดหน่อย เพื่อรองรับ 5 เมนู */
        line-height: 1.1;
        transition: color 0.2s ease;
        white-space: nowrap; /* ป้องกันข้อความตกบรรทัด */
    }

    /* เอฟเฟกต์ตอนเอานิ้วชี้หรือวางเมาส์ค้าง (Hover/Focus) */
    .mobile-fixed-bottom-nav__item:hover,
    .mobile-fixed-bottom-nav__item:focus-visible {
        color: var(--primary, #f857a6);
    }

    /* เอฟเฟกต์ตอนเอานิ้วกด (Tap/Active) -> เด้งดึ๋ง! */
    .mobile-fixed-bottom-nav__item:active {
        background: rgba(0, 0, 0, 0.02);
    }

    .mobile-fixed-bottom-nav__item:active .mobile-fixed-bottom-nav__icon {
        transform: scale(1.3) translateY(-3px);
        color: var(--primary, #f857a6);
    }

    .mobile-fixed-bottom-nav__item:active .mobile-fixed-bottom-nav__label {
        color: var(--primary, #f857a6);
    }

    /* ระยะห่างให้เนื้อหาเว็บไม่โดนเมนูบัง */
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }
}

/* ================================
   ✨ BACK TO TOP BUTTON
   ================================ */

.back-to-top {
    position: fixed;
    bottom: 30px; /* ระยะปกติบน Desktop */
    right: 30px;
    background: linear-gradient(135deg, var(--primary, #f857a6), var(--secondary, #ff5858));
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 9998; /* ให้น้อยกว่าเมนูด้านล่าง (9999) เล็กน้อย */
    box-shadow: 0 5px 20px rgba(255, 88, 88, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* ซ่อนปุ่มเป็นค่าเริ่มต้น */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.8);
    transition: all 0.3s ease;
}

/* แสดงปุ่มเมื่อเลื่อนหน้าเว็บ (ควบคุมผ่าน JS) */
.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* เอฟเฟกต์ Hover เมื่อเอาเมาส์ชี้บน Desktop */
.back-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 30px rgba(255, 88, 88, 0.4);
}

/* ================================
   ปรับตำแหน่งสำหรับหน้าจอมือถือ
   ================================ */
@media (max-width: 768px) {
    .back-to-top {
        /* ดันปุ่มขึ้นมา 85px เพื่อให้พ้นแถบ mobile-fixed-bottom-nav */
        bottom: calc(85px + env(safe-area-inset-bottom)); 
        right: 20px;
        width: 50px;   /* ลดขนาดปุ่มลงนิดหน่อยให้เหมาะกับมือถือ */
        height: 50px;
        font-size: 1.2rem;
    }
    
    /* ปิดเอฟเฟกต์ Hover บนมือถือ ป้องกันปุ่มค้างตอนกด */
    .back-to-top:hover {
        transform: translateY(0) scale(1);
    }
    .back-to-top.show:active {
        transform: scale(0.9); /* ยุบตัวนิดๆ เวลากดแทน */
    }
}
/* ================================
   SMALL MOBILE (max-width: 480px)
   ================================ */

@media (max-width: 480px) {
    
    /* Hero Extra Small */
    .hero h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .hero p {
        font-size: 0.95rem;
    }
    
    .hero-buttons {
        gap: 12px;
    }
    
    .btn {
        padding: 14px 25px;
        font-size: 0.95rem;
        max-width: 100%;
    }
    
    /* Sections Extra Small */
    section {
        padding: 50px 0;
    }
    
    .section-title h2 {
        font-size: 1.8rem;
    }
    
    .section-title p {
        font-size: 0.95rem;
    }
    
    /* Cards Extra Small */
    .service-card,
    .about-card,
    .portfolio-item {
        max-width: 100%;
    }
    
    .service-content,
    .about-card,
    .portfolio-content {
        padding: 20px 15px;
    }
    
    .service-icon {
        height: 100px;
        font-size: 2.5rem;
    }
    
    .about-icon {
        font-size: 3rem;
    }
    
    .highlight-number {
        font-size: 2.5rem;
    }
    
    /* Contact Extra Small */
    .contact-form {
        padding: 25px 15px;
    }
    
    .contact-form h3 {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }
    
    .form-control {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 14px 25px;
        font-size: 0.95rem;
    }
    
    /* Portfolio Filter Extra Small */
    .portfolio-filter {
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .filter-btn {
        padding: 8px 15px;
        font-size: 0.85rem;
        flex: 1;
        min-width: 80px;
        max-width: 100px;
    }
    
    /* Process Extra Small */
    .step {
        padding: 30px 15px 25px;
    }
    
    .step-number {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin: -30px auto 20px;
    }
    
    .step h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .step p {
        font-size: 0.9rem;
    }
    
    /* Contact Items Extra Small */
    .contact-item {
        padding: 15px;
    }
    
    .contact-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .contact-item div h3 {
        font-size: 1.1rem;
    }
    
    .contact-item div p {
        font-size: 0.9rem;
    }
    
    /* Footer Extra Small */
    .footer-container {
        gap: 25px;
    }
    
    .footer-logo {
        font-size: 1.4rem;
    }
    
    .footer-title {
        font-size: 1.1rem;
    }
    
    .footer-links ul li a {
        font-size: 0.9rem;
    }
    
    .copyright {
        font-size: 0.85rem;
        padding: 20px 15px;
    }
    
    /* Social Links Extra Small */
    .social-links a {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    /* Back to Top Extra Small */
    .back-to-top {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    /* Navigation Extra Small */
    nav ul {
        padding: 20px 15px;
    }
    
    nav ul li a {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    /* Header Extra Small */
    .header-container {
        padding: 12px 0;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .logo-image {
        height: 35px;
    }
    
    .footer-logo {
        font-size: 1.4rem;
    }
    
    .footer-logo-image {
        height: 30px;
    }
}

/* ================================
   LANDSCAPE MOBILE (max-height: 500px and orientation: landscape)
   ================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 100px 0 60px;
    }
    
    .hero h1 {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .hero p {
        margin-bottom: 20px;
        font-size: 1rem;
    }
    
    .hero-buttons {
        margin-top: 25px;
        gap: 15px;
    }
    
    .btn {
        padding: 12px 30px;
        font-size: 0.95rem;
    }
    
    /* Reduce section padding in landscape */
    section {
        padding: 40px 0;
    }
    
    .section-title {
        margin-bottom: 30px;
    }
    
    .section-title h2 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
}

/* ================================
   TABLET LANDSCAPE (768px - 1024px and landscape)
   ================================ */

@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .hero h1 {
        font-size: 2.8rem;
    }
    
    .services-grid,
    .about-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .process-steps {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    .contact-container {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }
}

/* ================================
   PRINT STYLES
   ================================ */

@media print {
    /* Hide non-essential elements */
    header,
    .hero-buttons,
    .cta-button,
    .mobile-menu-toggle,
    .back-to-top,
    .social-links,
    footer,
    .contact-form,
    .portfolio-filter,
    .service-card:hover,
    .btn {
        display: none !important;
    }
    
    /* Reset colors for print */
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Adjust sections for print */
    section {
        padding: 20pt 0 !important;
        page-break-inside: avoid;
    }
    
    .section-title h2 {
        color: black !important;
        font-size: 18pt !important;
        margin-bottom: 10pt !important;
    }
    
    .section-title p {
        color: black !important;
        font-size: 11pt !important;
    }
    
    /* Service cards for print */
    .service-card {
        border: 1pt solid #ccc !important;
        margin-bottom: 10pt !important;
        page-break-inside: avoid;
    }
    
    .service-content {
        padding: 10pt !important;
    }
    
    .service-content h3 {
        color: black !important;
        font-size: 14pt !important;
    }
    
    .service-content p {
        color: black !important;
        font-size: 10pt !important;
    }
    
    /* Contact info for print */
    .contact-info {
        page-break-inside: avoid;
    }
    
    .contact-item {
        border: none !important;
        background: none !important;
        color: black !important;
        margin-bottom: 5pt !important;
    }
}

/* ================================
   HIGH CONTRAST MODE SUPPORT
   ================================ */

@media (prefers-contrast: high) {
    :root {
        --primary: #000000;
        --secondary: #000000;
        --accent: #000000;
        --gray: #000000;
        --border: #000000;
        --light: #ffffff;
        --dark: #000000;
    }
    
    .btn {
        border: 2px solid currentColor !important;
    }
    
    .service-card,
    .about-card,
    .portfolio-item {
        border: 2px solid #000000 !important;
    }
    
    .form-control {
        border: 2px solid #000000 !important;
    }
    
    .filter-btn {
        border: 2px solid #000000 !important;
    }
    
    /* Ensure sufficient contrast */
    .hero,
    .contact {
        background: #000000 !important;
        color: #ffffff !important;
    }
    
    .section-title h2 {
        color: #000000 !important;
        -webkit-text-fill-color: #000000 !important;
    }
}

/* ================================
   REDUCED MOTION SUPPORT
   ================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero::before {
        animation: none !important;
    }
    
    .logo i {
        animation: none !important;
    }
    
    .featured-badge {
        animation: none !important;
    }
    
    .service-card:hover,
    .about-card:hover,
    .portfolio-item:hover,
    .btn:hover {
        transform: none !important;
    }
}

/* ================================
   DARK MODE SUPPORT (if implemented)
   ================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --light: #1e293b;
        --dark: #f8fafc;
        --light-gray: #334155;
        --white: #0f172a;
        --border: #475569;
        --gray: #cbd5e1;
    }
    
    body {
        background-color: #0f172a;
        color: #f8fafc;
    }
    
    .service-card,
    .about-card,
    .portfolio-item,
    .contact-form {
        background: #1e293b;
        color: #f8fafc;
    }
    
    .form-control {
        background: #334155;
        color: #f8fafc;
        border-color: #475569;
    }
    
    .section-title p {
        color: #cbd5e1;
    }
    
    .service-content p,
    .about-card p,
    .portfolio-item p {
        color: #cbd5e1;
    }
}

/* ================================
   TOUCH DEVICE OPTIMIZATIONS
   ================================ */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn,
    .filter-btn,
    .mobile-menu-toggle,
    .back-to-top {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-control {
        min-height: 44px;
    }
    
    /* Remove hover effects for touch devices */
    .service-card:hover,
    .about-card:hover,
    .portfolio-item:hover {
        transform: none;
    }
    
    /* Improve touch feedback */
    .service-card:active,
    .about-card:active,
    .portfolio-item:active,
    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Larger click areas for navigation */
    nav ul li a {
        padding: 16px 24px;
    }
    
    /* Better spacing for mobile */
    .contact-item {
        margin-bottom: 20px;
    }
    
    .social-links a {
        margin: 5px;
    }
}

/* ================================
   ACCESSIBILITY IMPROVEMENTS
   ================================ */

/* Focus indicators */
@media (prefers-reduced-motion: no-preference) {
    a:focus,
    button:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
        transition: outline-offset 0.2s ease;
    }
}

/* High contrast focus indicators */
@media (prefers-contrast: high) {
    a:focus,
    button:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 3px solid #000000;
        outline-offset: 2px;
    }
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-to-content:focus {
    top: 6px;
}

/* ================================
   RESPONSIVE IMAGES
   ================================ */

img {
    max-width: 100%;
    height: auto;
}

.portfolio-image img,
.before-after-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ================================
   RESPONSIVE TYPOGRAPHY
   ================================ */

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
}

@media (min-width: 1400px) {
    html {
        font-size: 16px;
    }
}

/* ================================
   UTILITY CLASSES FOR RESPONSIVE
   ================================ */

/* Responsive Visibility */
.hide-on-mobile {
    display: block;
}

.show-on-mobile {
    display: none;
}

.hide-on-tablet {
    display: block;
}

.show-on-tablet {
    display: none;
}

.hide-on-desktop {
    display: block;
}

.show-on-desktop {
    display: none;
}

@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }
    
    .show-on-mobile {
        display: block !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hide-on-tablet {
        display: none !important;
    }
    
    .show-on-tablet {
        display: block !important;
    }
}

@media (min-width: 1025px) {
    .hide-on-desktop {
        display: none !important;
    }
    
    .show-on-desktop {
        display: block !important;
    }
}

/* Responsive Text Alignment */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
    
    .text-left-mobile {
        text-align: left !important;
    }
}

/* Responsive Spacing */
@media (max-width: 768px) {
    .p-mobile-10 { padding: 10px !important; }
    .p-mobile-15 { padding: 15px !important; }
    .p-mobile-20 { padding: 20px !important; }
    
    .m-mobile-10 { margin: 10px !important; }
    .m-mobile-15 { margin: 15px !important; }
    .m-mobile-20 { margin: 20px !important; }
}

/* ================================
   RESPONSIVE GRID SYSTEM
   ================================ */

.responsive-grid {
    display: grid;
    gap: 20px;
}

.responsive-grid.cols-1 {
    grid-template-columns: 1fr;
}

.responsive-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.responsive-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.responsive-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .responsive-grid.cols-2,
    .responsive-grid.cols-3,
    .responsive-grid.cols-4 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .responsive-grid.cols-3,
    .responsive-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ================================
   CONTAINER QUERIES (Future-proofing)
   ================================ */

@supports (container-type: inline-size) {
    .card-container {
        container-type: inline-size;
    }
    
    @container (max-width: 300px) {
        .service-card .service-content {
            padding: 15px;
        }
        
        .service-card h3 {
            font-size: 1.2rem;
        }
    }
}

/* ================================
   PERFORMANCE OPTIMIZATIONS
   ================================ */

/* Reduce animations on lower-end devices */
@media (max-width: 480px) {
    .service-card,
    .about-card,
    .portfolio-item {
        transition-duration: 0.2s;
    }
    
    .animate-on-scroll {
        transition-duration: 0.3s;
    }

    /* Back to Top Extra Small */
    .back-to-top {
        bottom: 85px !important; /* ✅ แก้เป็น 85px และใส่ !important เพื่อป้องกันการโดนทับอีก */
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
        z-index: 9998; /* ✅ ย้ำให้อยู่ใต้เมนูด้านล่างนิดนึง เผื่อเลื่อนมาชนกัน */
    }
}

/* ================================
   RESPONSIVE NAVIGATION
   ================================ */

@media (max-width: 768px) {
    #nav-menu {
        display: none;
        position: absolute;
        top: 100%;  /* วางเมนูใต้ header */
        left: 0;
        width: 100%;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        padding: 20px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    }

    #nav-menu.show {
        display: block;
    }

    nav ul {
        flex-direction: column;  /* ทำให้เมนูเป็นแนวตั้ง */
        gap: 10px;
    }

    nav ul li a {
        font-size: clamp(1.05rem, 1.6vw, 1.25rem);
        padding: 15px;
        text-align: center;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .header-container {
        flex-wrap: wrap;  /* ปรับ layout header ถ้าจำเป็น */
    }

    .language-switcher {
        margin-left: 0;
        margin-top: 10px;
    }

    .cta-button {
        margin-top: 10px;
        width: 100%;
        text-align: center;
    }
}

@media (min-width: 769px) {
    #nav-menu {
        display: flex !important;  /* บังคับแสดงบน desktop */
    }

    .mobile-menu-toggle {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .section-title h2 {
        font-size: 2rem;
    }
    
    .about-grid,
    .services-grid,
    .reasons-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .service-card.popular {
        transform: none;
    }
    
    .service-card.popular:hover {
        transform: translateY(-10px);
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .quick-contact {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .contact-item {
        justify-content: flex-start !important;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 0 15px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .about-card,
    .service-card,
    .reason-card {
        padding: 25px 20px;
    }
    
    .section-title h2 {
        font-size: 1.8rem;
    }
    
    .popular-badge {
        right: 15px;
        padding: 6px 15px;
        font-size: 0.7rem;
    }
}