/* ============================================
   TUNJUNG TRANSPORT - MOBILE PREMIUM
   Clean, Optimized & SEO-Friendly
   Version: 2.1.0
   ============================================ */

/* ========================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   Core Web Vitals Ready
======================================== */

/* Reduce layout shifts on mobile */
img {
    aspect-ratio: attr(width) / attr(height);
    height: auto;
    max-width: 100%;
}

/* Touch-friendly tap targets */
button,
a,
input,
select,
textarea {
    min-height: 44px;
    min-width: 44px;
}

/* Smooth scrolling with 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;
    }
}

/* ========================================
   MOBILE TYPOGRAPHY - Premium Readability
======================================== */
@media (max-width: 767px) {
    html {
        font-size: 15px;
    }

    body {
        line-height: 1.65;
        -webkit-text-size-adjust: 100%;
        text-rendering: optimizeLegibility;
    }

    h1 {
        font-size: 1.875rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    h2 {
        font-size: 1.5rem;
        line-height: 1.25;
        margin-bottom: 0.875rem;
    }

    h3 {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    h4 {
        font-size: 1.125rem;
    }

    p {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
}

/* ========================================
   MOBILE CONTAINER & SPACING
======================================== */
@media (max-width: 767px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .section {
        padding: 48px 0;
    }

    .section-sm {
        padding: 32px 0;
    }

    .section-lg {
        padding: 56px 0;
    }
}

/* ========================================
   MOBILE BUTTONS - Touch Optimized
======================================== */
@media (max-width: 767px) {
    .btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 1rem;
        border-radius: 12px;
        justify-content: center;
    }

    .btn-sm {
        padding: 12px 20px;
        font-size: 0.9375rem;
    }

    .btn-lg {
        padding: 16px 28px;
        font-size: 1.0625rem;
    }

    /* Button group on mobile */
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .btn-inline {
        width: auto;
    }
}

/* ========================================
   MOBILE CARDS - Optimized Layout
======================================== */
@media (max-width: 767px) {
    .card {
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .card-body {
        padding: 20px;
    }

    .card-header,
    .card-footer {
        padding: 16px 20px;
    }

    /* Card grid on mobile */
    .card-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ========================================
   MOBILE FORMS - Clean & Accessible
======================================== */
@media (max-width: 767px) {

    input,
    select,
    textarea {
        width: 100%;
        padding: 14px 16px;
        font-size: 16px !important;
        /* Prevent iOS zoom */
        border-radius: 12px;
        border: 1.5px solid var(--gray-200);
        background: var(--white);
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    input:focus,
    select:focus,
    textarea:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(255, 111, 97, 0.15);
        outline: none;
    }

    label {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
        font-size: 0.9375rem;
        color: var(--gray-700);
    }

    .form-group {
        margin-bottom: 20px;
    }

    /* Form row on mobile */
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .form-row>* {
        flex: 1;
    }

    /* Select wrapper for custom arrow */
    .select-wrapper {
        position: relative;
    }

    .select-wrapper::after {
        content: '';
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 6px solid var(--gray-500);
        pointer-events: none;
    }

    .select-wrapper select {
        appearance: none;
        padding-right: 40px;
    }
}

/* ========================================
   MOBILE HERO SECTION
======================================== */
@media (max-width: 767px) {
    .hero {
        min-height: auto;
        padding: 40px 0 48px;
    }

    .hero-content {
        text-align: center;
    }

    .hero-title {
        font-size: 1.875rem;
        margin-bottom: 16px;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 24px;
        line-height: 1.6;
    }

    .hero-cta {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
}

/* ========================================
   MOBILE GRID SYSTEM
======================================== */
@media (max-width: 767px) {
    .row {
        margin: 0 -8px;
    }

    .col,
    [class*="col-"] {
        padding: 0 8px;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 16px;
    }

    .col:last-child,
    [class*="col-"]:last-child {
        margin-bottom: 0;
    }

    /* Two column grid on mobile */
    .col-mobile-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* ========================================
   MOBILE NAVIGATION MENU
======================================== */
@media (max-width: 767px) {

    /* Mobile nav overlay */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
        z-index: 998;
    }

    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Mobile sidebar menu */
    .mobile-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        background: var(--white);
        z-index: 999;
        display: flex;
        flex-direction: column;
        transition: right 0.3s ease;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    }

    .mobile-menu.active {
        right: 0;
    }

    .mobile-menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        border-bottom: 1px solid var(--gray-100);
    }

    .mobile-menu-close {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: var(--gray-100);
        border-radius: 10px;
        font-size: 20px;
        color: var(--gray-600);
        cursor: pointer;
    }

    .mobile-menu-body {
        flex: 1;
        padding: 20px;
        overflow-y: auto;
    }

    .mobile-menu-links {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .mobile-menu-links li {
        margin-bottom: 4px;
    }

    .mobile-menu-links a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 16px;
        color: var(--gray-700);
        font-weight: 500;
        font-size: 1rem;
        border-radius: 12px;
        transition: all 0.2s;
    }

    .mobile-menu-links a:hover,
    .mobile-menu-links a.active {
        background: var(--primary);
        color: var(--white);
    }

    .mobile-menu-links a i {
        width: 20px;
        text-align: center;
        font-size: 1.1rem;
    }

    .mobile-menu-footer {
        padding: 20px;
        border-top: 1px solid var(--gray-100);
    }
}

/* ========================================
   MOBILE IMAGES & MEDIA
======================================== */
@media (max-width: 767px) {
    img {
        max-width: 100%;
        height: auto;
    }

    .img-fluid {
        width: 100%;
    }

    .img-cover {
        object-fit: cover;
        width: 100%;
    }

    /* Responsive video container */
    .video-wrapper {
        position: relative;
        padding-bottom: 56.25%;
        /* 16:9 ratio */
        height: 0;
        overflow: hidden;
        border-radius: 16px;
    }

    .video-wrapper iframe,
    .video-wrapper video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* ========================================
   MOBILE TABLES
======================================== */
@media (max-width: 767px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 16px;
    }

    table {
        min-width: 600px;
    }

    /* Card-style table for mobile */
    .table-card {
        display: block;
    }

    .table-card thead {
        display: none;
    }

    .table-card tbody {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .table-card tr {
        display: block;
        background: var(--white);
        border-radius: 12px;
        padding: 16px;
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--gray-200);
    }

    .table-card td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--gray-100);
    }

    .table-card td:last-child {
        border-bottom: none;
    }

    .table-card td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray-600);
    }
}

/* ========================================
   MOBILE MODAL & DIALOGS
======================================== */
@media (max-width: 767px) {
    .modal-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }

    .modal-backdrop.active {
        opacity: 1;
        visibility: visible;
    }

    .modal-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 90vh;
        background: var(--white);
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        display: flex;
        flex-direction: column;
    }

    .modal-backdrop.active .modal-content {
        transform: translateY(0);
    }

    .modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px;
        border-bottom: 1px solid var(--gray-100);
    }

    .modal-body {
        flex: 1;
        padding: 20px;
        overflow-y: auto;
    }

    .modal-footer {
        padding: 16px 20px;
        border-top: 1px solid var(--gray-100);
    }

    /* Modal handle indicator */
    .modal-handle {
        width: 40px;
        height: 4px;
        background: var(--gray-300);
        border-radius: 2px;
        margin: 12px auto;
    }
}

/* ========================================
   MOBILE FOOTER
======================================== */
@media (max-width: 767px) {
    .footer {
        padding: 40px 0 100px;
        /* Extra padding for safe area */
    }

    .footer-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .footer-brand {
        text-align: center;
        margin-bottom: 16px;
    }

    .footer-links {
        text-align: center;
    }

    .footer-links ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .footer-social {
        display: flex;
        justify-content: center;
        gap: 12px;
    }

    .footer-social a {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .footer-bottom {
        text-align: center;
        padding-top: 24px;
        margin-top: 24px;
        border-top: 1px solid var(--gray-200);
    }
}

/* ========================================
   MOBILE ACCESSIBILITY IMPROVEMENTS
======================================== */
@media (max-width: 767px) {

    /* Focus visible for keyboard navigation */
    *:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

    /* Skip link for screen readers */
    .skip-link {
        position: absolute;
        top: -50px;
        left: 16px;
        padding: 12px 24px;
        background: var(--secondary);
        color: var(--white);
        border-radius: 8px;
        font-weight: 600;
        z-index: 9999;
        transition: top 0.3s;
    }

    .skip-link:focus {
        top: 16px;
    }

    /* Larger touch targets for icons */
    .icon-btn {
        min-width: 48px;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========================================
   MOBILE UTILITY CLASSES
======================================== */
@media (max-width: 767px) {
    .mobile-hidden {
        display: none !important;
    }

    .mobile-visible {
        display: block !important;
    }

    .mobile-visible-flex {
        display: flex !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

    .mobile-text-left {
        text-align: left !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

    .mobile-stack {
        flex-direction: column !important;
    }

    .mobile-gap-sm {
        gap: 8px !important;
    }

    .mobile-gap-md {
        gap: 16px !important;
    }

    .mobile-mb-0 {
        margin-bottom: 0 !important;
    }

    .mobile-mb-md {
        margin-bottom: 16px !important;
    }

    .mobile-p-md {
        padding: 16px !important;
    }
}

/* ========================================
   MOBILE SAFE AREA SUPPORT
======================================== */
@supports (padding: max(0px)) {
    @media (max-width: 767px) {
        .safe-area-inset {
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
            padding-bottom: max(16px, env(safe-area-inset-bottom));
        }

        .footer {
            padding-bottom: max(80px, calc(60px + env(safe-area-inset-bottom)));
        }
    }
}

/* ========================================
   DARK MODE SUPPORT (Mobile)
======================================== */
@media (max-width: 767px) and (prefers-color-scheme: dark) {
    :root {
        --white: #1a1a2e;
        --gray-50: #22223b;
        --gray-100: #2d2d4a;
        --gray-200: #3a3a5c;
        --gray-700: #e2e8f0;
        --gray-800: #f1f5f9;
        --gray-900: #f8fafc;
    }

    body {
        background: #0f0f1a;
    }
}

/* ========================================
   MOBILE LOADING SKELETON
======================================== */
@media (max-width: 767px) {
    .skeleton {
        background: linear-gradient(90deg,
                var(--gray-200) 0%,
                var(--gray-100) 50%,
                var(--gray-200) 100%);
        background-size: 200% 100%;
        animation: skeleton-loading 1.5s ease-in-out infinite;
        border-radius: 8px;
    }

    .skeleton-text {
        height: 16px;
        margin-bottom: 8px;
    }

    .skeleton-title {
        height: 24px;
        width: 60%;
        margin-bottom: 16px;
    }

    .skeleton-card {
        height: 200px;
        border-radius: 16px;
    }

    @keyframes skeleton-loading {
        0% {
            background-position: 200% 0;
        }

        100% {
            background-position: -200% 0;
        }
    }
}

/* ========================================
   MOBILE SMOOTH SCROLLING & MOMENTUM
======================================== */
@media (max-width: 767px) {
    .scroll-container {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .scroll-container::-webkit-scrollbar {
        display: none;
    }

    .scroll-item {
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    /* Horizontal scroll cards */
    .horizontal-scroll {
        display: flex;
        gap: 16px;
        padding: 4px 16px 16px;
        margin: 0 -16px;
    }

    .horizontal-scroll>* {
        flex: 0 0 280px;
        max-width: 280px;
    }
}

/* ========================================
   MOBILE PULL TO REFRESH INDICATOR
======================================== */
@media (max-width: 767px) {
    .pull-indicator {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%) translateY(-100%);
        background: var(--white);
        padding: 12px 24px;
        border-radius: 0 0 16px 16px;
        box-shadow: var(--shadow-md);
        font-size: 14px;
        color: var(--gray-600);
        z-index: 900;
        transition: transform 0.3s;
    }

    .pull-indicator.visible {
        transform: translateX(-50%) translateY(0);
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {

    .no-print,
    .public-header,
    .footer,
    .mobile-toggle,
    .btn-book {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ========================================
   MOBILE DOM OPTIMIZATION
   Reduce DOM elements for faster performance
======================================== */
@media (max-width: 768px) {

    /* Hide extra testimonial cards on mobile (keep first 3) */
    .testimonials-track .testimonial-card:nth-child(n+4) {
        display: none !important;
    }

    /* Hide carousel navigation on mobile since fewer cards */
    .carousel-nav.carousel-prev,
    .carousel-nav.carousel-next {
        display: none !important;
    }

    /* Simplify stats section */
    .testimonials-stats .stat-box:nth-child(n+4) {
        display: none !important;
    }

    /* Hide non-essential elements in footer on mobile */
    .public-footer .footer-col:nth-child(3),
    .public-footer .footer-col:nth-child(4) {
        display: none !important;
    }
}