/**
 * TKD State Pages - Mobile Optimization
 * 
 * Comprehensive mobile-first responsive design for state directory pages
 * Optimizes layout, touch targets, and user experience on mobile devices
 * Based on city mobile optimization patterns
 */

/* ============================================
   CRITICAL MOBILE LAYOUT FIXES
   ============================================ */

/* Mobile: 320px - 768px */
@media (max-width: 768px) {
    /* === CONTAINER & LAYOUT === */
    .tkd-city-page,
    .tkd-state-page,
    body.tkd-state-template,
    .tkd-city-directory-container {
        padding: 1rem 0 !important;
        overflow-x: hidden;
    }

    /* === GLOBAL ICON ALIGNMENT === */
    .tkd-section-title i,
    .tkd-social-title i,
    .tkd-city-header h1 i,
    .tkd-hero-header h1 i,
    .tkd-stat-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        vertical-align: middle !important;
    }

    /* === CONTAINER OPTIMIZATION === */
    .glass-business-container {
        padding: 1rem 0.75rem !important; /* REDUCED: Less padding on mobile */
        min-height: auto !important;
    }

    .glass-main-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem 0.75rem !important; /* REDUCED: Less padding */
        gap: 1rem !important; /* REDUCED: Tighter spacing */
        border-radius: 12px !important;
    }

    /* === BREADCRUMB - Mobile Optimized === */
    .tkd-breadcrumb {
        padding: 0.625rem 0.875rem !important; /* REDUCED: More compact */
        margin: 0 auto 1.25rem auto !important; /* REDUCED: Less bottom margin */
        font-size: 0.8rem !important; /* REDUCED: Smaller text */
        max-width: calc(100% - 1.5rem) !important;
        border-radius: 10px !important;
        background: rgba(255, 255, 255, 0.05) !important;
    }

    .tkd-breadcrumb ol {
        gap: 0.4rem !important; /* REDUCED: Tighter gap */
        font-size: 0.8rem !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    .tkd-breadcrumb a,
    .tkd-breadcrumb span {
        font-size: 0.8rem !important;
    }

    .tkd-breadcrumb li {
        white-space: nowrap !important;
    }

    .tkd-breadcrumb .separator {
        margin: 0 0.35rem !important;
    }

    /* === HERO HEADER - Mobile Optimized === */
    .tkd-hero-header,
    .tkd-city-header {
        padding: 1.5rem 0.75rem !important; /* REDUCED: Less padding */
        margin: 0 auto 1.5rem auto !important; /* REDUCED: Less margin */
        text-align: center !important;
        border-radius: 12px !important;
    }

    .tkd-hero-header h1,
    .tkd-city-title {
        font-size: clamp(1.5rem, 6vw, 2rem) !important; /* RESPONSIVE: Scales with viewport */
        line-height: 1.2 !important;
        margin: 0 0 0.875rem 0 !important; /* REDUCED: Less margin */
        word-wrap: break-word !important;
        hyphens: auto !important;
        padding: 0 0.5rem !important; /* ADDED: Prevent edge touching */
    }

    .tkd-hero-subtitle,
    .tkd-hero-header p,
    .tkd-city-description {
        font-size: 0.9rem !important; /* REDUCED: Smaller subtitle */
        line-height: 1.5 !important;
        margin: 0 auto 1.5rem auto !important; /* REDUCED: Less margin */
        padding: 0 0.75rem !important; /* ADDED: Side padding */
        max-width: 100% !important;
        opacity: 0.85 !important;
    }

    /* === STATISTICS SECTION - Mobile Optimized === */
    .tkd-hero-header .tkd-hero-stats,
    .tkd-hero-stats,
    body.tkd-state-template .tkd-hero-stats,
    .tkd-city-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; /* TWO COLUMNS: Better for mobile */
        gap: 0.75rem !important; /* REDUCED: Tighter gap */
        margin: 1.5rem auto !important; /* REDUCED: Less margin */
        padding: 1rem 0.75rem !important; /* REDUCED: Less padding */
        border-radius: 12px !important;
        max-width: 100% !important;
    }

    .tkd-hero-header .tkd-hero-stats .tkd-stat-item,
    .tkd-hero-stats .tkd-stat-item,
    body.tkd-state-template .tkd-hero-stats .tkd-stat-item,
    .tkd-city-stats .tkd-stat-item,
    .tkd-stat-item {
        padding: 0.875rem 0.625rem !important; /* REDUCED: More compact */
        min-width: auto !important;
        max-width: none !important;
        border-radius: 10px !important;
        display: flex !important;
        flex-direction: row !important; /* CHANGED: Horizontal layout for hero stats */
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        min-height: auto !important;
        overflow: visible !important;
        gap: 0.625rem !important; /* REDUCED: Tighter gap */
        flex: 0 0 auto !important;
    }

    /* 5th stat item - spans full width on mobile */
    .tkd-hero-header .tkd-hero-stats .tkd-stat-item:nth-child(5),
    .tkd-hero-stats .tkd-stat-item:nth-child(5),
    body.tkd-state-template .tkd-hero-stats .tkd-stat-item:nth-child(5) {
        grid-column: 1 / -1 !important; /* SPAN: Full width for 5th item */
        max-width: none !important;
        margin: 0 !important;
    }

    /* City stats keep column layout */
    .tkd-city-stats .tkd-stat-item {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .tkd-hero-stats .tkd-stat-icon,
    body.tkd-state-template .tkd-hero-stats .tkd-stat-icon,
    .tkd-stat-icon {
        font-size: 1.25rem !important; /* REDUCED: Smaller icon */
        margin: 0 !important;
        flex-shrink: 0 !important;
        display: block !important;
        width: auto !important;
    }

    .tkd-hero-stats .tkd-stat-text,
    body.tkd-state-template .tkd-hero-stats .tkd-stat-text,
    .tkd-stat-text {
        font-size: 0.7rem !important;
        line-height: 1.4 !important;
        text-align: left !important; /* CHANGED: Left align for hero stats */
        display: flex !important;
        flex-direction: column !important;
        gap: 0.15rem !important;
        width: 100% !important;
        flex: 1 !important;
        min-width: 0 !important; /* ALLOW: Text to shrink */
    }

    .tkd-city-stats .tkd-stat-text {
        text-align: center !important; /* KEEP: Center for city stats */
    }

    .tkd-hero-stats .tkd-stat-number,
    body.tkd-state-template .tkd-hero-stats .tkd-stat-number,
    .tkd-stat-text .tkd-stat-number,
    .tkd-stat-number {
        font-size: 1.1rem !important; /* REDUCED: Smaller number */
        margin: 0 0.25rem 0 0 !important; /* CHANGED: Right margin for inline */
        display: inline !important; /* CHANGED: Inline for horizontal layout */
        font-weight: 700 !important;
        line-height: 1.2 !important;
    }

    .tkd-hero-stats .tkd-stat-label,
    body.tkd-state-template .tkd-hero-stats .tkd-stat-label,
    .tkd-hero-stats .tkd-stat-text > span:not(.tkd-stat-number),
    body.tkd-state-template .tkd-hero-stats .tkd-stat-text > span:not(.tkd-stat-number),
    .tkd-stat-label {
        font-size: 0.7rem !important; /* REDUCED: Smaller label */
        line-height: 1.3 !important;
        opacity: 0.85 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        text-transform: none !important; /* REMOVED: No uppercase */
        letter-spacing: normal !important;
        max-width: 100%;
    }

    /* === SECTION TITLES === */
    .tkd-city-section,
    .tkd-cities-section {
        margin-bottom: 1.5rem !important;
        padding: 0 8px !important;
    }

    .tkd-section-title {
        font-size: 1.25rem !important;
        margin-bottom: 0.875rem !important;
        padding-bottom: 0.5rem !important;
        display: inline-flex !important;
        gap: 0.4rem !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: center !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        width: auto !important;
    }

    .tkd-section-title i {
        font-size: 1.1rem !important;
        flex-shrink: 0 !important;
        line-height: 1 !important;
        vertical-align: middle !important;
        margin: 0 !important;
        display: inline-block !important;
    }

    .tkd-section-title::after {
        width: 40px !important;
        height: 2px !important;
        bottom: 0 !important;
    }

    /* === MAJOR CITIES SECTION === */
    .tkd-cities-section {
        padding: 1.25rem 0.5rem !important;
        margin: 0 8px 1.5rem 8px !important;
        border-radius: 12px !important;
    }

    .tkd-cities-grid {
        grid-template-columns: 1fr !important;
        gap: 0.875rem !important;
        padding: 0 0.5rem;
    }

    .tkd-city-card {
        padding: 1rem !important;
        border-radius: 12px !important;
        border-width: 1.5px !important;
        transition: all 0.2s ease !important;
    }

    /* Disable transform on touch devices */
    @media (hover: none) and (pointer: coarse) {
        .tkd-city-card:hover {
            transform: none !important;
        }

        .tkd-city-card:active {
            transform: scale(0.98) !important;
        }
    }

    .tkd-city-name {
        font-size: 1.05rem !important;
        margin-bottom: 0.625rem !important;
        line-height: 1.3;
    }

    .tkd-city-stats {
        gap: 0.35rem !important;
        margin-bottom: 0.75rem !important;
    }

    .tkd-city-stat {
        padding: 0.5rem 0.25rem !important;
        border-radius: 6px !important;
    }

    .tkd-city-stat-number {
        font-size: 1.05rem !important;
        margin-bottom: 0.15rem;
    }

    .tkd-city-stat-label {
        font-size: 0.625rem !important;
        line-height: 1.2;
    }

    .tkd-city-actions {
        margin-top: 0.75rem !important;
    }

    .tkd-city-explore-btn {
        padding: 0.625rem 0.875rem !important;
        font-size: 0.8rem !important;
        min-height: 44px !important;
        border-radius: 8px !important;
        gap: 0.35rem !important;
    }

    .tkd-city-explore-btn i {
        font-size: 0.75rem !important;
    }

    /* === TOP RATED GRID === */
    .tkd-top-rated-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    /* === BUSINESS GRID === */
    .tkd-businesses-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* === BUSINESS CARDS === */
    .tkd-business-card,
    .tkd-top-rated-card {
        margin-bottom: 10px !important;
        border-radius: 12px !important;
        padding: 0.875rem !important;
    }

    .tkd-card-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    .tkd-business-image {
        width: 90px !important;
        height: 90px !important;
        margin: 0 auto !important;
    }

    .tkd-business-info {
        width: 100% !important;
    }

    .tkd-business-header {
        margin-bottom: 0.625rem !important;
    }

    .tkd-business-name {
        font-size: 1rem !important;
        text-align: center !important;
        margin: 0 0 0.5rem 0 !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        line-height: 1.3 !important;
    }

    .tkd-business-name a {
        word-wrap: break-word;
        word-break: break-word;
    }

    .tkd-business-meta {
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    .tkd-business-rating,
    .tkd-rating-compact {
        margin-bottom: 0.375rem !important;
    }

    .tkd-stars {
        gap: 1px !important;
    }

    .tkd-star {
        font-size: 1em !important;
    }

    .tkd-rating-number {
        font-size: 0.95rem !important;
    }

    .tkd-review-count,
    .tkd-rating-text {
        font-size: 0.8rem !important;
    }

    /* === STATUS BADGES === */
    .tkd-status-sponsored,
    .tkd-status-verified {
        padding: 4px 9px !important;
        font-size: 0.65rem !important;
        border-radius: 10px !important;
    }

    /* === BUSINESS DETAILS === */
    .tkd-business-details {
        text-align: center !important;
        margin-bottom: 0.875rem !important;
    }

    .tkd-business-address,
    .tkd-business-phone,
    .tkd-detail-item {
        justify-content: center !important;
        font-size: 0.8rem !important;
        margin-bottom: 0.375rem !important;
    }

    .tkd-detail-item i {
        font-size: 0.95rem !important;
    }

    .tkd-business-description {
        font-size: 0.8rem !important;
        margin-top: 0.625rem !important;
        text-align: center !important;
        line-height: 1.4 !important;
    }

    /* === CARD ACTIONS === */
    .tkd-card-actions {
        flex-direction: column !important;
        gap: 0.625rem !important;
        margin-top: 0.875rem !important;
        padding-top: 0.875rem !important;
    }

    .tkd-btn {
        width: 100% !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.8rem !important;
        min-height: 44px !important;
        border-radius: 8px !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .tkd-btn-primary,
    .tkd-btn-secondary,
    .tkd-btn-call {
        padding: 0.75rem 1rem !important;
    }

    /* === PAGINATION === */
    .tkd-pagination {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        margin: 2rem 8px !important;
        padding: 0 0.5rem !important;
    }

    .tkd-page-link {
        padding: 0.625rem 0.875rem !important;
        font-size: 0.875rem !important;
        min-width: 40px !important;
        min-height: 40px !important;
        border-radius: 6px !important;
    }

    .tkd-page-link.tkd-prev,
    .tkd-page-link.tkd-next {
        padding: 0.625rem 1rem !important;
    }

    .tkd-page-ellipsis {
        padding: 0.625rem 0.5rem !important;
    }

    /* === CONTROLS SECTION === */
    .tkd-city-controls,
    .tkd-state-controls {
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 1rem !important;
        margin: 0 8px 1.5rem 8px !important;
    }

    .tkd-search-bar {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.75rem !important;
        min-width: auto !important;
    }

    .tkd-search-bar input {
        width: 100% !important;
        padding: 0.875rem 1rem !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        flex: none !important;
    }

    .tkd-search-bar button {
        width: 100% !important;
        padding: 0.875rem 1.5rem !important;
        min-height: 48px !important;
    }

    .tkd-filter-controls {
        width: 100% !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .tkd-filter-controls select,
    .tkd-filter-controls button {
        width: 100% !important;
        padding: 0.875rem 1rem !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        min-height: 48px !important;
    }

    /* === SOCIAL SHARING SECTION === */
    .tkd-social-sharing-section {
        margin: 0.75rem 8px 2rem 8px !important; /* Reduced top margin to reduce gap after Business Insights */
        padding: 1.5rem 1rem !important;
        border-radius: 12px !important;
    }

    .tkd-social-header {
        margin-bottom: 1.25rem !important;
    }

    .tkd-social-title {
        font-size: 1rem !important;
        gap: 0.4rem !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        line-height: 1 !important;
    }

    .tkd-social-title i {
        font-size: 0.95rem !important;
        line-height: 1 !important;
        vertical-align: middle !important;
        flex-shrink: 0 !important;
    }

    .tkd-social-subtitle {
        font-size: 0.85rem !important;
        line-height: 1.4;
    }

    .tkd-social-buttons {
        gap: 0.625rem !important;
        margin-top: 1.25rem !important;
    }

    .tkd-social-btn {
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem !important;
        gap: 0.35rem !important;
        border-radius: 8px !important;
        min-height: 44px !important;
        flex: 1 1 calc(50% - 0.35rem);
        min-width: 140px;
    }

    .tkd-social-btn i {
        font-size: 0.95rem !important;
    }

    .tkd-social-btn span {
        font-size: 0.85rem;
    }

    /* === FOOTER SECTIONS === */
    .tkd-state-navigation-footer {
        margin: 1.5rem 8px !important;
        padding-top: 1.25rem !important;
        max-width: 100% !important;
    }

    .tkd-view-all-btn,
    .tkd-view-all-states-btn,
    .tkd-view-all-cities-btn {
        padding: 0.875rem 1.5rem !important;
        font-size: 0.9rem !important;
        gap: 0.5rem !important;
        border-radius: 10px !important;
        min-height: 48px !important;
        width: 100%;
        max-width: 300px;
    }

    .tkd-view-all-btn i,
    .tkd-view-all-states-btn i,
    .tkd-view-all-cities-btn i {
        font-size: 1rem !important;
    }
}

/* ============================================
   EXTRA SMALL MOBILE: ≤480px
   ============================================ */

@media (max-width: 480px) {
    /* === ULTRA-COMPACT LAYOUT === */
    .glass-business-container {
        padding: 10px 5px !important;
    }

    .glass-main-card {
        padding: 12px 6px !important;
        gap: 12px !important;
        border-radius: 10px !important;
    }

    /* === BREADCRUMB === */
    .tkd-breadcrumb {
        padding: 0.625rem 0.875rem !important;
        margin: 0 6px 0.875rem 6px !important;
        font-size: 0.8rem !important;
    }

    .tkd-breadcrumb ol {
        gap: 0.35rem !important;
        font-size: 0.8rem !important;
    }

    .tkd-breadcrumb .separator {
        margin: 0 0.25rem !important;
    }

    /* === HERO HEADER === */
    .tkd-hero-header {
        padding: 1.25rem 0.875rem !important;
        margin: 0 6px 1.25rem 6px !important;
    }

    .tkd-hero-header h1 {
        font-size: clamp(1.25rem, 5.5vw, 1.625rem) !important;
        margin-bottom: 0.625rem !important;
    }

    .tkd-hero-subtitle {
        font-size: 0.875rem !important;
        margin-bottom: 1rem !important;
        padding: 0 0.25rem;
    }

    /* === STATISTICS === */
    .tkd-hero-stats,
    body.tkd-state-template .tkd-hero-stats {
        gap: 0.625rem !important; /* REDUCED: Even tighter */
        margin: 1.25rem auto !important;
        padding: 0.875rem 0.5rem !important;
        border-radius: 10px !important;
    }

    .tkd-hero-stats .tkd-stat-item,
    body.tkd-state-template .tkd-hero-stats .tkd-stat-item {
        padding: 0.75rem 0.5rem !important; /* REDUCED: More compact */
        border-radius: 8px !important;
        gap: 0.5rem !important;
        flex-direction: row !important; /* KEEP: Horizontal layout */
    }

    .tkd-hero-stats .tkd-stat-icon,
    body.tkd-state-template .tkd-hero-stats .tkd-stat-icon {
        font-size: 1.1rem !important; /* REDUCED: Smaller icon */
    }

    .tkd-hero-stats .tkd-stat-number,
    body.tkd-state-template .tkd-hero-stats .tkd-stat-number {
        font-size: 1rem !important; /* REDUCED: Smaller number */
    }

    .tkd-hero-stats .tkd-stat-label,
    body.tkd-state-template .tkd-hero-stats .tkd-stat-label,
    .tkd-hero-stats .tkd-stat-text > span:not(.tkd-stat-number),
    body.tkd-state-template .tkd-hero-stats .tkd-stat-text > span:not(.tkd-stat-number) {
        font-size: 0.65rem !important; /* REDUCED: Smaller label */
        line-height: 1.25 !important;
    }

    /* === SECTIONS === */
    .tkd-section-header {
        padding: 0 0.75rem !important;
        margin-bottom: 1.25rem !important;
        text-align: center;
    }

    .tkd-section-title {
        font-size: 1.375rem !important;
        margin-bottom: 0.5rem !important;
        display: inline-flex !important;
        gap: 0.45rem !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        align-items: center !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        width: auto !important;
    }

    .tkd-section-title i {
        font-size: 1.125rem !important;
        flex-shrink: 0 !important;
        line-height: 1 !important;
        vertical-align: middle !important;
        margin: 0 !important;
        display: inline-block !important;
    }

    .tkd-section-subtitle {
        font-size: 0.85rem !important;
        text-align: center;
        display: block;
    }

    /* === CITIES SECTION === */
    .tkd-cities-section {
        padding: 1rem 0.375rem !important;
        margin: 0 6px 1.25rem 6px !important;
    }

    .tkd-cities-grid {
        gap: 0.75rem !important;
        padding: 0 0.375rem;
    }

    .tkd-city-card {
        padding: 0.875rem !important;
    }

    .tkd-city-name {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    .tkd-city-stats {
        gap: 0.25rem !important;
        margin-bottom: 0.625rem !important;
    }

    .tkd-city-stat {
        padding: 0.45rem 0.2rem !important;
    }

    .tkd-city-stat-number {
        font-size: 0.975rem !important;
    }

    .tkd-city-stat-label {
        font-size: 0.6rem !important;
    }

    .tkd-city-explore-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
        min-height: 42px !important;
        gap: 0.3rem !important;
    }

    .tkd-city-explore-btn i {
        font-size: 0.7rem !important;
    }

    /* === BUSINESS CARDS === */
    .tkd-business-card,
    .tkd-top-rated-card {
        padding: 0.875rem !important;
    }

    .tkd-business-image {
        width: 80px !important;
        height: 80px !important;
    }

    .tkd-business-name {
        font-size: 1rem !important;
    }

    .tkd-btn {
        padding: 0.625rem 0.875rem !important;
        font-size: 0.8rem !important;
        min-height: 42px !important;
    }

    /* === PAGINATION === */
    .tkd-pagination {
        gap: 0.375rem !important;
        margin: 1.5rem 6px !important;
    }

    .tkd-page-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }

    /* === FOOTER === */
    .tkd-state-navigation-footer {
        margin: 1.25rem 6px !important;
        padding-top: 1rem !important;
    }

    .tkd-view-all-btn,
    .tkd-view-all-states-btn,
    .tkd-view-all-cities-btn {
        padding: 0.75rem 1.25rem !important;
        font-size: 0.85rem !important;
        gap: 0.4rem !important;
        width: 100%;
        max-width: 280px;
    }

    /* === SOCIAL SHARING === */
    .tkd-social-sharing-section {
        margin: 0.75rem 6px 1.75rem 6px !important; /* Reduced top margin to reduce gap */
        padding: 1.25rem 0.875rem !important;
    }

    .tkd-social-title {
        font-size: 1rem !important;
        gap: 0.4rem !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        line-height: 1 !important;
    }

    .tkd-social-title i {
        font-size: 0.95rem !important;
        line-height: 1 !important;
        vertical-align: middle !important;
        flex-shrink: 0 !important;
    }

    .tkd-social-subtitle {
        font-size: 0.8rem !important;
    }

    .tkd-social-buttons {
        gap: 0.5rem !important;
        margin-top: 1rem !important;
        flex-direction: column;
    }

    .tkd-social-btn {
        padding: 0.625rem 0.875rem !important;
        font-size: 0.8rem !important;
        gap: 0.3rem !important;
        min-height: 42px !important;
        width: 100% !important;
        flex: none;
        min-width: auto;
    }

    .tkd-social-btn i {
        font-size: 0.9rem !important;
    }

    .tkd-social-btn span {
        font-size: 0.8rem;
    }

    /* === CONTROLS === */
    .tkd-city-controls,
    .tkd-state-controls {
        padding: 0.875rem !important;
        margin: 0 6px 1.25rem 6px !important;
        gap: 0.875rem !important;
    }

    .tkd-search-bar {
        gap: 0.625rem !important;
    }

    .tkd-search-bar input {
        padding: 0.75rem 0.875rem !important;
        min-height: 42px !important;
    }

    .tkd-search-bar button {
        padding: 0.75rem 1.25rem !important;
        min-height: 42px !important;
    }

    .tkd-filter-controls select,
    .tkd-filter-controls button {
        padding: 0.75rem 0.875rem !important;
        min-height: 42px !important;
    }
}

/* ============================================
   TABLET OPTIMIZATIONS: 481px - 768px
   ============================================ */

@media (min-width: 481px) and (max-width: 768px) {
    /* Two-column grid for tablets */
    .tkd-cities-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .tkd-hero-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .tkd-top-rated-grid {
        grid-template-columns: 1fr !important;
    }

    .tkd-businesses-grid {
        grid-template-columns: 1fr !important;
    }

    /* Social buttons in rows of 3 */
    .tkd-social-btn {
        flex: 1 1 calc(33.333% - 0.5rem);
        min-width: 120px;
    }
}

/* ============================================
   LARGE MOBILE/SMALL TABLET: 481px - 640px
   ============================================ */

@media (min-width: 481px) and (max-width: 640px) {
    .tkd-hero-header h1 {
        font-size: clamp(1.75rem, 5vw, 2.25rem) !important;
    }

    .tkd-section-title {
        font-size: clamp(1.5rem, 4vw, 1.875rem) !important;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .tkd-city-explore-btn,
    .tkd-social-btn,
    .tkd-view-all-btn,
    .tkd-view-all-states-btn,
    .tkd-view-all-cities-btn,
    .tkd-btn {
        min-height: 48px !important;
        padding: 0.875rem 1rem !important;
    }

    /* Remove hover effects, use active states */
    .tkd-city-card:hover,
    .tkd-business-card:hover,
    .tkd-top-rated-card:hover,
    .tkd-social-btn:hover,
    .tkd-city-explore-btn:hover,
    .tkd-btn:hover {
        transform: none !important;
    }

    .tkd-city-card:active,
    .tkd-business-card:active,
    .tkd-top-rated-card:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s ease !important;
    }

    .tkd-social-btn:active,
    .tkd-city-explore-btn:active,
    .tkd-btn:active {
        transform: translateY(1px) !important;
        transition: transform 0.1s ease !important;
    }

    /* Disable touch callout */
    * {
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }

    /* Enable tap highlight for interactive elements */
    a, button, .tkd-city-card, .tkd-business-card {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Reduce animations for better performance */
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }

    /* Simplify shadows on mobile */
    .tkd-hero-header,
    .tkd-hero-stats,
    .tkd-city-card,
    .tkd-business-card,
    .tkd-social-sharing-section {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
    }

    /* Disable backdrop filters on older mobile devices */
    @supports not (backdrop-filter: blur(10px)) {
        .tkd-hero-header,
        .tkd-hero-stats,
        .tkd-breadcrumb {
            background: rgba(255, 255, 255, 0.95) !important;
        }
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Reduced motion for accessibility */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .tkd-city-card:active,
    .tkd-business-card:active,
    .tkd-social-btn:active {
        transform: none !important;
    }
}

/* High contrast mode */
@media (max-width: 768px) and (prefers-contrast: high) {
    .tkd-city-card,
    .tkd-business-card,
    .tkd-breadcrumb,
    .tkd-hero-header,
    .tkd-hero-stats {
        border: 2px solid #000 !important;
    }
}

/* Dark mode considerations */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .tkd-breadcrumb,
    .tkd-hero-header,
    .tkd-hero-stats,
    .tkd-city-card,
    .tkd-business-card {
        background: rgba(255, 255, 255, 0.98) !important;
    }
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
    /* Reduce vertical spacing in landscape */
    .tkd-hero-header {
        padding: 1rem 1rem !important;
    }

    .tkd-hero-subtitle {
        margin-bottom: 1rem !important;
    }

    .tkd-hero-stats {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.5rem !important;
        padding: 0.75rem !important;
    }

    .tkd-stat-item {
        flex-direction: column !important;
        gap: 0.25rem !important;
        padding: 0.625rem 0.5rem !important;
    }

    .tkd-stat-item:nth-child(5),
    .tkd-stat-item:last-child {
        grid-column: auto !important;
    }

    .tkd-stat-text {
        text-align: center !important;
        font-size: 0.7rem !important;
    }

    .tkd-stat-number {
        font-size: 0.95rem !important;
    }

    .tkd-cities-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
   VERY SMALL SCREENS: ≤360px
   ============================================ */

@media (max-width: 360px) {
    /* Allow text wrapping on very small screens if needed */
    .tkd-section-title {
        white-space: normal !important;
        text-align: center;
        word-wrap: break-word;
        font-size: clamp(1.125rem, 4vw, 1.375rem) !important;
    }
    
    .tkd-hero-header h1 {
        font-size: clamp(1.125rem, 5vw, 1.375rem) !important;
    }

    .tkd-section-subtitle {
        font-size: 0.8rem !important;
    }

    .tkd-stat-icon {
        font-size: 1rem !important;
    }

    .tkd-stat-text {
        font-size: 0.7rem !important;
    }

    .tkd-stat-number {
        font-size: 0.95rem !important;
    }

    .tkd-city-explore-btn,
    .tkd-social-btn,
    .tkd-view-all-btn,
    .tkd-btn {
        font-size: 0.725rem !important;
        padding: 0.625rem 0.75rem !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .tkd-social-sharing-section,
    .tkd-state-navigation-footer,
    .tkd-filter-controls,
    .tkd-pagination {
        display: none !important;
    }

    .tkd-city-card,
    .tkd-business-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .tkd-hero-header {
        background: #f8f9fa !important;
        color: #000 !important;
    }
}
