/**
 * Conversation Cards Page - Mobile Styles
 * App-style design for lovesite.co.il
 * Works with site header and footer
 */

@media (max-width: 768px) {
    /* ========================================
       Page Body - Mobile
       ======================================== */
    body.conversation-cards-page-body {
        background: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 50%, #e8eaf6 100%) !important;
        overflow-x: hidden !important;
        min-height: 100vh !important;
    }

    /* Accessibility widget positioning */
    .a11y-widget-panel {
        z-index: 9999 !important;
        position: fixed !important;
    }

    /* ========================================
       MOBILE RESTRUCTURE SUPPORT
       JS moves cards-page-wrapper to be direct child of body
       ======================================== */

    /* When JS has restructured, hide old content (header.php tables) */
    body.mobile-restructured > *:not(.cards-page-wrapper):not(.mobile-header):not(.mobile-bottom-nav):not(.a11y-widget-panel):not(.instructions-overlay):not(.toast):not(script):not(style):not(link) {
        display: none !important;
    }

    /* The cards-page-wrapper after JS moves it */
    body.mobile-restructured > .cards-page-wrapper {
        display: block !important;
    }

    /* ========================================
       Cards Page Wrapper - Mobile
       ======================================== */
    .cards-page-wrapper {
        display: block !important;
        padding-top: 80px !important;
        padding-bottom: 100px !important;
        min-height: auto !important;
        width: 100% !important;
        position: relative !important;
        z-index: 10 !important;
    }

    .container {
        max-width: 100% !important;
        padding: 16px !important;
    }

    /* ========================================
       Header Section - Mobile
       ======================================== */
    .cards-header {
        padding: 16px 0 20px !important;
    }

    .cards-logo {
        font-size: 40px !important;
        margin-bottom: 8px !important;
    }

    .cards-title {
        font-size: 24px !important;
    }

    .cards-subtitle {
        font-size: 13px !important;
    }

    /* ========================================
       Navigation Pills - Mobile
       ======================================== */
    .nav-pills {
        gap: 8px !important;
        margin-bottom: 20px !important;
        justify-content: center !important;
    }

    .nav-pill {
        padding: 10px 16px !important;
        font-size: 13px !important;
        border-radius: 20px !important;
    }

    /* ========================================
       Mode Selection - Mobile
       ======================================== */
    .mode-section {
        margin-bottom: 24px !important;
    }

    .section-title {
        font-size: 16px !important;
        margin-bottom: 12px !important;
    }

    .mode-cards {
        gap: 12px !important;
    }

    .mode-card {
        padding: 16px !important;
        border-radius: 14px !important;
    }

    .mode-card-icon {
        font-size: 32px !important;
        margin-bottom: 8px !important;
    }

    .mode-card-title {
        font-size: 14px !important;
    }

    .mode-card-desc {
        font-size: 11px !important;
    }

    /* ========================================
       Category Chips - Mobile
       ======================================== */
    .category-chips {
        gap: 8px !important;
        justify-content: center !important;
    }

    .category-chip {
        padding: 10px 14px !important;
        font-size: 13px !important;
        border-radius: 18px !important;
    }

    /* ========================================
       Depth Section - Mobile
       ======================================== */
    .depth-section {
        padding: 16px !important;
        border-radius: 14px !important;
        margin-bottom: 16px !important;
    }

    .depth-slider {
        height: 10px !important;
    }

    .depth-slider::-webkit-slider-thumb {
        width: 28px !important;
        height: 28px !important;
    }

    /* ========================================
       Cards Limit - Mobile
       ======================================== */
    .cards-limit {
        gap: 8px !important;
        margin-bottom: 20px !important;
    }

    .limit-btn {
        padding: 14px 10px !important;
        font-size: 13px !important;
        border-radius: 12px !important;
    }

    /* ========================================
       Start Button - Mobile
       ======================================== */
    .btn-start {
        padding: 16px !important;
        font-size: 17px !important;
        border-radius: 14px !important;
        margin-bottom: 16px !important;
    }

    .btn-start:hover {
        transform: none !important;
    }

    .btn-start:active {
        transform: scale(0.98) !important;
    }

    /* ========================================
       Room Section - Mobile
       ======================================== */
    .room-section {
        padding: 16px !important;
        border-radius: 14px !important;
        margin-top: 16px !important;
    }

    .room-section-title {
        font-size: 15px !important;
    }

    .room-input {
        padding: 14px !important;
        font-size: 18px !important;
        border-radius: 12px !important;
    }

    .btn-join {
        padding: 14px 20px !important;
        font-size: 14px !important;
        border-radius: 12px !important;
    }

    /* ========================================
       Game Screen - Mobile
       ======================================== */
    .game-screen {
        padding-bottom: 80px !important;
    }

    .game-header {
        margin-bottom: 16px !important;
    }

    .game-back {
        padding: 8px 12px !important;
        font-size: 13px !important;
        border-radius: 10px !important;
    }

    .progress-bar {
        width: 80px !important;
    }

    /* ========================================
       Game Card - Mobile
       ======================================== */
    .card-container {
        margin-bottom: 20px !important;
    }

    .game-card {
        padding: 24px 20px !important;
        border-radius: 18px !important;
        min-height: 300px !important;
    }

    .card-meta {
        margin-bottom: 16px !important;
    }

    .card-category-label {
        font-size: 11px !important;
        padding: 4px 10px !important;
    }

    .card-question {
        font-size: 20px !important;
        line-height: 1.6 !important;
    }

    .card-rule {
        padding: 10px 12px !important;
        font-size: 12px !important;
        border-radius: 10px !important;
        margin-top: 16px !important;
    }

    .card-followup {
        font-size: 13px !important;
        margin-top: 12px !important;
        padding-top: 12px !important;
    }

    /* ========================================
       Card Actions - Mobile
       ======================================== */
    .card-actions {
        gap: 12px !important;
        margin-bottom: 16px !important;
    }

    .card-action-btn {
        width: 54px !important;
        height: 54px !important;
        font-size: 22px !important;
    }

    .card-action-btn.next {
        width: 70px !important;
        height: 70px !important;
        font-size: 26px !important;
    }

    .card-action-btn:hover {
        transform: none !important;
    }

    .card-action-btn:active {
        transform: scale(0.95) !important;
    }

    /* ========================================
       Room Screen - Mobile
       ======================================== */
    .room-code-display {
        padding: 24px 16px !important;
        border-radius: 16px !important;
        margin-bottom: 20px !important;
    }

    .room-code {
        font-size: 36px !important;
        letter-spacing: 6px !important;
    }

    .room-share-btn {
        padding: 12px 24px !important;
        font-size: 14px !important;
        border-radius: 22px !important;
    }

    .turn-indicator {
        padding: 16px !important;
        border-radius: 14px !important;
        margin-bottom: 16px !important;
    }

    .turn-indicator h3 {
        font-size: 16px !important;
    }

    /* ========================================
       Favorites - Mobile
       ======================================== */
    .favorites-list {
        gap: 12px !important;
    }

    .favorite-card {
        padding: 16px !important;
        border-radius: 14px !important;
    }

    .favorite-card-meta {
        font-size: 11px !important;
    }

    .favorite-card-text {
        font-size: 15px !important;
    }

    .favorite-btn {
        padding: 10px 16px !important;
        font-size: 13px !important;
        border-radius: 18px !important;
    }

    /* ========================================
       Empty State - Mobile
       ======================================== */
    .empty-state {
        padding: 40px 16px !important;
    }

    .empty-icon {
        font-size: 50px !important;
    }

    .empty-title {
        font-size: 18px !important;
    }

    /* ========================================
       Game Over - Mobile
       ======================================== */
    .game-over {
        padding: 40px 16px !important;
    }

    .game-over-icon {
        font-size: 60px !important;
    }

    .game-over-title {
        font-size: 24px !important;
    }

    /* ========================================
       Instructions Modal - Mobile
       ======================================== */
    .instructions-overlay {
        padding: 12px !important;
        z-index: 2000 !important;
    }

    .instructions-modal {
        max-height: 90vh !important;
        border-radius: 18px !important;
    }

    .instructions-header {
        padding: 20px 16px !important;
    }

    .instructions-header-icon {
        font-size: 40px !important;
    }

    .instructions-header h2 {
        font-size: 20px !important;
    }

    .instructions-header p {
        font-size: 13px !important;
    }

    .instructions-content {
        padding: 20px 16px !important;
    }

    .instructions-section {
        margin-bottom: 20px !important;
    }

    .instructions-section-title {
        font-size: 15px !important;
    }

    .instructions-section-content {
        font-size: 13px !important;
    }

    .instruction-step {
        gap: 10px !important;
    }

    .step-number {
        width: 24px !important;
        height: 24px !important;
        font-size: 12px !important;
    }

    .step-content {
        font-size: 13px !important;
    }

    .instructions-highlight {
        padding: 12px !important;
        border-radius: 12px !important;
    }

    .instructions-footer {
        padding: 16px !important;
    }

    .dont-show-again {
        font-size: 13px !important;
    }

    .btn-close-instructions {
        padding: 14px !important;
        font-size: 15px !important;
        border-radius: 12px !important;
    }

    /* ========================================
       Toast - Mobile
       ======================================== */
    .toast {
        bottom: 20px !important;
        padding: 12px 20px !important;
        font-size: 13px !important;
        max-width: calc(100% - 40px) !important;
    }

    /* ========================================
       Touch Feedback
       ======================================== */
    .mode-card,
    .category-chip,
    .limit-btn,
    .btn-start,
    .btn-join,
    .card-action-btn,
    .nav-pill,
    .favorite-btn {
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }

    /* ========================================
       Safe Area Support (iPhone notch)
       ======================================== */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        .cards-page-wrapper {
            padding-bottom: calc(30px + env(safe-area-inset-bottom)) !important;
        }

        .game-screen {
            padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
        }
    }
}

/* Small phones */
@media (max-width: 375px) {
    .container {
        padding: 12px !important;
    }

    .mode-cards {
        grid-template-columns: 1fr !important;
    }

    .cards-limit {
        flex-direction: column !important;
    }

    .limit-btn {
        width: 100% !important;
    }

    .card-question {
        font-size: 18px !important;
    }

    .room-code {
        font-size: 28px !important;
        letter-spacing: 4px !important;
    }
}
