/* ===== MOBILE RESPONSIVE OPTIMIZATION (Phase 2) ===== */

/* Touch-friendly targets */
@media (max-width: 1024px) {
    button, .nav-link, .filter-btn, .search-btn, a.modal-action-primary, a.modal-action-secondary {
        min-height: 44px;
        min-width: 44px;
    }

    /* Nav improvements */
    .nav-links {
        max-height: 80vh;
        overflow-y: auto;
    }

    .nav-links li a {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    /* Watchlist page */
    .watchlist-header {
        flex-direction: column;
        gap: 16px;
    }

    .watchlist-add-form {
        flex-direction: column;
        gap: 12px;
    }

    .watchlist-add-form input {
        width: 100%;
    }

    .watchlist-card {
        padding: 16px;
    }

    .watchlist-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .watchlist-card-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .watchlist-card-actions button {
        flex: 1;
    }

    /* Compare page */
    .compare-inputs {
        flex-direction: column;
        gap: 16px;
    }

    .compare-vs {
        transform: rotate(90deg);
    }

    .compare-grid {
        grid-template-columns: 1fr;
    }

    .compare-metric-row {
        flex-direction: column;
        gap: 8px;
    }

    .compare-metric-value {
        text-align: left;
    }

    /* Live detection cards */
    .detection-card {
        padding: 16px;
    }

    .detection-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .detection-analysis {
        font-size: 0.8rem;
        -webkit-line-clamp: 3;
    }

    /* Modal improvements */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 5vh auto;
        padding: 20px;
    }

    .modal-token-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .modal-score-section {
        flex-direction: column;
        align-items: center;
    }

    .modal-actions {
        flex-direction: column;
        gap: 10px;
    }

    .modal-actions a {
        text-align: center;
    }

    /* Scanner results */
    .result-scores {
        grid-template-columns: 1fr;
    }

    .score-card {
        padding: 16px;
    }

    /* Weather signals */
    .weather-signals {
        grid-template-columns: 1fr;
    }

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

    /* Crime scene */
    .crime-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .entity-grid {
        grid-template-columns: 1fr;
    }

    /* Language switcher */
    .lang-switcher {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
    }

    .lang-switcher select {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    /* DNA page */
    .dna-score-ring {
        width: 140px;
        height: 140px;
    }

    .traits-grid {
        grid-template-columns: 1fr;
    }

    /* General spacing */
    .page-header h1 {
        font-size: 1.8rem;
    }

    .page-header p {
        font-size: 0.85rem;
    }

    /* Token CA */
    .token-ca {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .token-ca code {
        font-size: 0.65rem;
        word-break: break-all;
    }
}

/* Extra small devices */
@media (max-width: 380px) {
    .container {
        padding: 0 12px;
    }

    .nav-inner {
        padding: 0 12px;
    }

    .hero-title {
        font-size: 1.7rem;
    }

    .weather-metrics {
        grid-template-columns: 1fr;
    }

    .crime-summary-grid {
        grid-template-columns: 1fr;
    }

    .detection-tags {
        flex-wrap: wrap;
    }

    .detection-tag {
        font-size: 0.65rem;
    }

    .phase-content {
        padding: 14px;
    }

    .phase-content h2 {
        font-size: 1rem;
    }

    .phase-items li {
        font-size: 0.78rem;
    }
}

/* Landscape phones */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 80px 0 40px;
    }

    .modal-content {
        max-height: 95vh;
    }

    .roadmap-timeline {
        max-width: 100%;
    }
}

/* Safe area for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .site-footer, .footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .lang-switcher {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* Smooth scrolling for all */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* Better tap highlight */
* {
    -webkit-tap-highlight-color: rgba(212, 168, 83, 0.1);
}

/* Prevent horizontal overflow */
body {
    overflow-x: hidden;
}

/* Improved focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Loading states for mobile */
@media (max-width: 768px) {
    .skeleton {
        background: linear-gradient(90deg, rgba(255,255,255,0.02) 25%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.02) 75%);
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
    }

    @keyframes shimmer {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
}
