/* Mobile Responsiveness Stylesheet for CarDatabases.com */

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

/* Mobile Menu Container */
.mobile-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #0a0f14;
    border-top: 1px solid #1f2937;
    padding: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.mobile-menu.active {
    display: flex;
}

/* Mobile menu overlay (data-mobile-menu) */
[data-mobile-menu] {
    display: none !important;
}

[data-mobile-menu].active {
    display: block !important;
}

/* Override Tailwind's hidden class when active */
[data-mobile-menu].hidden.active {
    display: block !important;
}

.mobile-menu a,
.mobile-menu .language-switcher {
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #1f2937;
}

.mobile-menu a:last-child {
    border-bottom: none;
}

.mobile-menu .btn-primary {
    margin-top: 0.5rem;
    justify-content: center;
}

.mobile-menu .language-switcher {
    border-bottom: none;
    padding: 0.5rem 0;
}

.mobile-menu .language-switcher select {
    width: 100%;
}

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

@media (max-width: 640px) {

    /* Headings */
    h1 {
        font-size: 2.5rem !important;
        /* Slightly smaller than 5xl but big enough */
        line-height: 1.1 !important;
        word-break: break-word;
        /* Prevent overflow */
        overflow-wrap: break-word;
    }

    h2 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }

    h3 {
        font-size: 1.5rem !important;
    }

    h4 {
        font-size: 1.25rem !important;
    }

    /* Paragraphs */
    p {
        font-size: 1rem !important;
    }

    /* Large text */
    .text-lg {
        font-size: 1rem !important;
    }

    .text-xl {
        font-size: 1.125rem !important;
    }
}

/* ============================================
   CODE BLOCKS & PRE
   ============================================ */

.code-window,
pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.code-window pre {
    font-size: 0.75rem;
    white-space: pre;
    word-wrap: normal;
}

@media (min-width: 640px) {
    .code-window pre {
        font-size: 0.875rem;
    }
}

/* Ensure code doesn't break layout */
code {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   TABLES
   ============================================ */

.table-wrapper,
.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
    /* Ensure it doesn't exceed viewport */
    width: 100%;
    display: block;
    /* Force block context */
}

table {
    min-width: 600px;
    /* Force scroll trigger */
    width: 100%;
}

@media (max-width: 640px) {
    table {
        font-size: 0.875rem;
    }

    th,
    td {
        padding: 0.75rem 0.5rem !important;
        /* Adjust padding */
        white-space: nowrap;
        /* Prevent wrapping inside cells to keep alignment */
    }
}

/* ============================================
   TOUCH TARGETS
   ============================================ */

/* Minimum touch target size */
button,
a.btn-primary,
a.btn-secondary,
.nav-link {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Increase padding for better touch */
@media (max-width: 768px) {
    .nav-link {
        padding: 0.75rem 1rem;
    }

    button,
    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 1.5rem;
    }
}

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

@media (max-width: 768px) {

    /* Force single column on mobile */
    .grid-cols-2,
    .grid-cols-3,
    .md\:grid-cols-2,
    .md\:grid-cols-3,
    .lg\:grid-cols-2,
    .lg\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   HERO SECTIONS
   ============================================ */

@media (max-width: 640px) {

    /* Hero content */
    .hero-content {
        text-align: center !important;
    }

    /* CTA buttons */
    .flex.flex-row {
        flex-direction: column !important;
    }

    .flex.flex-row>* {
        width: 100%;
    }
}

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

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

/* ============================================
   SPACING & PADDING
   ============================================ */

@media (max-width: 640px) {

    /* Reduce padding on mobile */
    .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .py-20,
    .py-24 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    .py-32 {
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }
}

/* ============================================
   CARDS
   ============================================ */

@media (max-width: 640px) {

    .card,
    .bg-secondary\/30 {
        padding: 1.5rem !important;
    }
}

/* ============================================
   FORMS
   ============================================ */

input,
select,
textarea {
    font-size: 16px !important;
    /* Prevents zoom on iOS */
    min-height: 44px;
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */

.language-switcher select {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
}

@media (max-width: 640px) {
    .language-switcher {
        width: 100%;
    }

    .language-switcher select {
        width: 100%;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

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

/* Show only on mobile */
.show-mobile {
    display: none !important;
}

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

/* Prevent horizontal scroll */
html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

/* Ensure all containers respect viewport width */
* {
    max-width: 100%;
}

/* Allow specific elements to exceed for scrolling */
.overflow-x-auto,
.table-wrapper,
pre,
code {
    max-width: 100vw;
}

/* ============================================
   ACTIVE STATES FOR TOUCH
   ============================================ */

button:active,
a:active {
    opacity: 0.8;
    transform: scale(0.98);
}

/* ============================================
   SCROLLBAR STYLING (WEBKIT)
   ============================================ */

.code-window::-webkit-scrollbar,
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.code-window::-webkit-scrollbar-track,
.table-wrapper::-webkit-scrollbar-track {
    background: #1f2937;
}

.code-window::-webkit-scrollbar-thumb,
.table-wrapper::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

.code-window::-webkit-scrollbar-thumb:hover,
.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}