/* ============================================================================
   Responsive & Motion
   Media queries, animations, and touch-specific adjustments
   ============================================================================ */

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Large tablets and small desktops */
@media (max-width: 1200px) {
  .container {
    padding: 0 30px;
  }
  
  .nav-container {
    padding: 0 30px;
  }

  .products-grid,
  .posts-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
  
  .services-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
  }
  
  .features-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* Narrow desktops: shrink navbar spacing before switching to mobile menu */
@media (max-width: 1120px) {
  .nav-container {
    padding: 0 20px;
    gap: 12px;
  }

  .nav-menu {
    gap: 0.8rem;
    margin: 0 0.8rem;
  }

  .nav-link {
    font-size: 0.9rem;
  }

  .nav-cta {
    padding: 8px 16px;
    font-size: 0.9rem;
  }

  .lang-btn {
    padding: 6px 10px;
    font-size: 13px;
  }
}

/* Tablet breakpoint: switch to hamburger menu */
@media (max-width: 1024px) {
  .nav-container {
    padding: 0 24px;
    height: 64px;
    gap: 16px;
  }

  .nav-menu {
    margin: 0;
    position: fixed;
    top: 64px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 64px);
    background: var(--primary-navy);
    flex-direction: column;
    justify-content: flex-start;
    padding: 50px 0;
    transition: var(--transition-normal);
    z-index: 1001;
    overflow-y: auto;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-link {
    padding: 15px 30px;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
  }

  .nav-cta {
    margin: 20px 30px 0;
    padding: 15px 30px;
    text-align: center;
  }

  .nav-actions {
    gap: 12px;
    flex-shrink: 1;
  }

  .nav-actions .nav-cta {
    min-width: auto;
    padding: 10px 18px;
    font-size: 0.95rem;
  }

  .language-switcher {
    margin: 0;
  }

  .lang-btn {
    padding: 6px 12px;
    font-size: 13px;
  }

  .nav-toggle {
    display: flex;
    margin-left: auto;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }

  .hero-container {
    align-items: center;
    text-align: center;
    padding: 120px 30px 90px;
  }
  
  .hero-content {
    text-align: center;
  }
  
  .hero-buttons {
    justify-content: center;
  }
  
  .hero-stats {
    width: 100%;
  }
  
  .about-content {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  
  .contact-content {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .about-stats {
    justify-content: center;
  }
  
  .service-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
  
  .reviews-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  .products-grid,
  .posts-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
  }

  .page-hero {
    padding: 100px 0 70px;
    text-align: center;
  }

  .page-description {
    margin-left: auto;
    margin-right: auto;
  }

  .featured-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
  }

  .featured-image {
    max-width: 520px;
    margin: 0 auto;
  }

  .featured-text {
    text-align: center;
  }

  .featured-text .post-meta,
  .post-author {
    justify-content: center;
  }
}

/* Tablets and small screens */
@media (max-width: 768px) {
  .container {
    padding: 0 20px;
  }

  .nav-container {
    padding: 0 20px;
    height: 60px; /* Smaller navbar on mobile */
    gap: 12px;
  }

  .nav-menu {
    top: 60px;
    height: calc(100vh - 60px);
  }

  .nav-actions {
    gap: 10px; /* Giảm gap trên mobile */
  }

  .nav-actions .nav-cta {
    display: none;
  }

  .lang-menu {
    min-width: 140px;
  }

  /* Hero Section Mobile */
  .hero {
    min-height: calc(100vh - 60px);
  }
  
  .hero-container {
    padding: 100px 20px 80px;
    align-items: center;
  }
  
  .hero-content {
    text-align: center;
  }
  
  .title-main {
    font-size: 2.5rem;
    line-height: 1.2;
  }
  
  .title-sub {
    font-size: 1.25rem;
  }
  
  .hero-description {
    font-size: 1.125rem;
    margin-bottom: 30px;
  }

  .featured-image img {
    height: 280px;
  }

  .featured-content {
    gap: 32px;
  }

  .featured-text {
    text-align: center;
  }

  .post-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .featured-text .post-meta {
    align-items: center;
  }

  .post-author {
    flex-direction: column;
    text-align: center;
  }

  .hero-stats {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .page-hero {
    padding: 90px 0 50px;
  }

  .page-title {
    font-size: 2.5rem;
  }

  .page-description {
    font-size: 1.0625rem;
    margin-left: auto;
    margin-right: auto;
  }
  
  /* Typography Mobile */
  .section-header h2 {
    font-size: 2rem;
    line-height: 1.3;
  }
  
  .section-header p {
    font-size: 1rem;
  }
  
  /* Grid Layouts Mobile */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .service-detail-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .reviews-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .products-grid,
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .product-card,
  .post-card {
    max-width: 520px;
    margin: 0 auto;
  }
  
  /* Buttons Mobile */
  .hero-buttons {
    justify-content: center;
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 280px;
    padding: 14px 24px;
    font-size: 1rem;
  }

  .product-content {
    padding: 24px 20px;
  }

  .product-actions {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
  }

  .product-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .cta-buttons {
    flex-direction: column;
  }

  .cta-buttons .btn {
    width: 100%;
    max-width: 280px;
  }

  .newsletter-form {
    flex-direction: column;
    max-width: 100%;
  }

  .newsletter-form button {
    width: 100%;
  }
  
  /* Sections Mobile */
  section {
    padding: 60px 0;
  }
  
  .service-card,
  .feature-item,
  .detail-card {
    padding: 25px 20px;
  }
  
  /* About Section Mobile */
  .about-stats {
    gap: 20px;
    flex-wrap: wrap;
  }
  
  .stat-item {
    flex: 1;
    min-width: 100px;
  }
  
  .stat-number {
    font-size: 2.5rem;
  }
  
  /* Contact Form Mobile */
  .contact-form {
    padding: 25px 20px;
  }
  
  .form-group {
    margin-bottom: 20px;
  }
  
  /* Footer Mobile */
  .footer-content {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  
  .footer-text {
    text-align: center;
  }
  
  /* Reviews Mobile Specific */
  .review-card {
    padding: 20px 15px;
  }
  
  .reviewer-avatar {
    width: 45px;
    height: 45px;
  }
  
  .summary-stats {
    flex-direction: column;
    gap: 25px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }
  
  .nav-container {
    padding: 0 15px;
    height: 55px;
  }
  
  .nav-logo {
    font-size: 1.25rem;
  }
  
  .nav-logo img {
    width: 36px;
    height: 36px;
  }
  
  .nav-menu {
    top: 55px;
    height: calc(100vh - 55px);
    padding: 30px 0;
  }
  
  /* Hero Mobile Small */
  .hero {
    min-height: calc(100vh - 55px);
  }
  
  .hero-container {
    padding: 80px 15px 60px;
    align-items: flex-start;
  }
  
  .title-main {
    font-size: 2rem;
    line-height: 1.1;
  }
  
  .title-sub {
    font-size: 1.125rem;
    line-height: 1.4;
  }
  
  .hero-description {
    font-size: 1rem;
    margin-bottom: 25px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .page-hero {
    padding: 80px 0 45px;
  }

  .page-title {
    font-size: 2.2rem;
  }

  .page-description {
    font-size: 1rem;
  }

  .products-grid,
  .posts-grid {
    gap: 20px;
  }

  .product-image {
    height: 200px;
  }

  .post-image {
    height: 180px;
  }

  .product-actions .btn,
  .cta-buttons .btn {
    max-width: 100%;
  }

  .newsletter-form {
    gap: 12px;
  }
  
  /* Typography Small Mobile */
  .section-header h2 {
    font-size: 1.75rem;
    line-height: 1.2;
  }
  
  .section-header p {
    font-size: 0.95rem;
  }
  
  /* Cards Small Mobile */
  .service-card,
  .detail-card,
  .feature-item {
    padding: 20px 15px;
  }
  
  .service-icon,
  .detail-icon,
  .feature-icon {
    width: 60px;
    height: 60px;
  }
  
  .service-icon i,
  .detail-icon i,
  .feature-icon i {
    font-size: 1.5rem;
  }
  
  /* Reviews Small Mobile */
  .review-card {
    padding: 15px;
  }
  
  .reviewer-avatar {
    width: 40px;
    height: 40px;
  }
  
  .reviewer-details h4 {
    font-size: 1rem;
  }
  
  .reviewer-details span {
    font-size: 0.85rem;
  }
  
  .review-text {
    font-size: 0.9rem;
    line-height: 1.5;
  }
  
  .overall-rating .rating-number {
    font-size: 2.25rem;
  }
  
  /* About Stats Small Mobile */
  .about-stats {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }
  
  .stat-item {
    min-width: auto;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  /* Contact Form Small Mobile */
  .contact-form {
    padding: 20px 15px;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px 16px;
    font-size: 0.95rem;
  }
  
  /* Buttons Small Mobile */
  .btn {
    padding: 12px 20px;
    font-size: 0.95rem;
  }
  
  /* Sections Spacing Small Mobile */
  section {
    padding: 50px 0;
  }
  
  .section-header {
    margin-bottom: 40px;
  }
  
  /* Back to Top Small Mobile */
  .back-to-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 20px;
    font-size: 1.1rem;
  }

  .floating-panels-container {
    right: clamp(12px, 4vw, 18px);
    bottom: clamp(64px, 16vh, 110px);
    gap: 10px;
  }

  .contact-fab__toggle,
  .chatbot-fab__toggle {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .contact-fab__actions {
    max-width: min(92vw, 280px);
  }

  .contact-fab__action {
    padding: 6px 10px;
    width: 100%;
    min-width: 0;
    max-width: 280px;
  }

  .contact-fab__label {
    display: inline-block;
    font-size: 0.9rem;
  }
  
  /* Loading Screen Small Mobile */
  .loading-logo {
    width: 70px;
    height: 70px;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .container {
    padding: 0 10px;
  }
  
  .title-main {
    font-size: 1.75rem;
  }
  
  .title-sub {
    font-size: 1rem;
  }
  
  .section-header h2 {
    font-size: 1.5rem;
  }
  
  .service-card,
  .detail-card,
  .feature-item,
  .review-card {
    padding: 15px 10px;
  }
  
  .contact-form {
    padding: 15px 10px;
  }
  
  .nav-link {
    padding: 12px 20px;
  }
  
  .nav-cta {
    margin: 15px 20px 0;
    padding: 12px 20px;
  }
}

/* ============================================================================
   CUSTOM ANIMATIONS
   ============================================================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* AOS Animation Overrides */
[data-aos="fade-up"] {
  transform: translateY(30px);
  opacity: 0;
}

[data-aos="fade-up"].aos-animate {
  transform: translateY(0);
  opacity: 1;
}

[data-aos="fade-left"] {
  transform: translateX(30px);
  opacity: 0;
}

[data-aos="fade-left"].aos-animate {
  transform: translateX(0);
  opacity: 1;
}

[data-aos="fade-right"] {
  transform: translateX(-30px);
  opacity: 0;
}

[data-aos="fade-right"].aos-animate {
  transform: translateX(0);
  opacity: 1;
}

/* ============================================================================
   MOBILE UTILITIES & TOUCH IMPROVEMENTS
   ============================================================================ */

/* Touch-friendly hover states */
@media (hover: none) and (pointer: coarse) {
  .service-card:hover,
  .feature-item:hover,
  .detail-card:hover,
  .review-card:hover {
    transform: none;
  }
  
  .btn:hover {
    transform: none;
  }
  
  .nav-cta:hover {
    transform: none;
  }
}

/* Improve touch targets */
@media (max-width: 768px) {
  .nav-link,
  .nav-cta,
  .btn,
  .service-link,
  .back-to-top,
  .contact-fab__toggle,
  .contact-fab__action {
    min-height: 44px; /* iOS recommended touch target */
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .social-links a {
    min-width: 48px;
    min-height: 48px;
  }
  
  /* Prevent zoom on form focus for iOS */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Mobile-specific animations */
@media (max-width: 768px) {
  .particle {
    display: none; /* Hide particles on mobile for performance */
  }
  
  /* Simplified animations */
  [data-aos] {
    animation-duration: 0.6s !important;
  }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: 100vh;
  }
  
  .hero-container {
    padding: 40px 20px;
  }
  
  .title-main {
    font-size: 2rem;
  }
  
  .nav-menu {
    height: calc(100vh - 60px);
    padding: 20px 0;
  }
  
  .nav-link {
    padding: 10px 30px;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .loading-logo,
  .nav-logo img,
  .footer-logo img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  /* Keep the existing design as it's already dark-themed */
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .loading-spinner {
    animation: none;
  }
  
  .particle {
    animation: none;
  }
}

/* Print Styles */
@media print {
  .navbar,
  .back-to-top,
  .contact-fab,
  .hero-particles,
  .loading-screen {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
  }
  
  .hero {
    background: white !important;
    color: black !important;
  }
  
  section {
    padding: 20px 0 !important;
    break-inside: avoid;
  }
  
  .service-card,
  .feature-item,
  .review-card {
    break-inside: avoid;
    margin-bottom: 15px;
  }
  
  .contact-form {
    display: none !important;
  }
}
