/**
 * Mobile App Experience
 * Transform the launcher into a native app-like experience on mobile
 * 
 * @package SENNA_Launcher
 * @since 4.2.0
 */

/* ===========================================
   MOBILE APP LAYOUT (max-width: 767px)
   =========================================== */

@media screen and (max-width: 767px) {
    
    /* ===============================
       FULL SCREEN APP EXPERIENCE
       =============================== */
    
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        /* Prevent pull-to-refresh */
        overscroll-behavior: contain;
        /* Smooth scrolling */
        -webkit-overflow-scrolling: touch;
        /* Prevent zoom on input focus */
        user-scalable: no;
        -webkit-user-scalable: no;
        /* Background color to match app */
        background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
        min-height: 100vh;
    }
    
    /* Full screen container */
    .skillfarm-launcher-container,
    .opportunities-launcher-container,
    .opp-launcher-container {
        min-height: 100vh;
        padding: 0;
        margin: 0;
        position: relative;
        display: flex;
        flex-direction: column;
        background: transparent;
    }
    
    /* Main content area - FULL WIDTH */
    .main-container,
    .opp-main-container {
        flex: 1;
        width: 100%;
        max-width: 100%;
        padding: 0 0 80px; /* Remove side padding for full width */
        margin: 0;
        border-radius: 0;
        background: transparent;
        min-height: calc(100vh - 80px);
        display: flex;
        flex-direction: column;
    }
    
    /* ===============================
       COMPACT HEADER
       =============================== */
    
    .header-container,
    .opp-header-container {
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 10px;
        margin: 0;
        position: sticky;
        top: 0;
        z-index: 100;
        /* iOS status bar padding */
        padding-top: max(10px, env(safe-area-inset-top));
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    /* Logo on the left */
    .logo-section,
    .opp-logo-section {
        justify-content: flex-start;
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .logo-text,
    .opp-logo-text {
        font-size: 1.1rem;
        font-weight: 600;
        color: #D4AF37;
        letter-spacing: 1px;
    }
    
    /* Hide or minimize journey progress in header */
    .journey-progress,
    .opp-journey-progress {
        display: none;
    }
    
    /* User welcome - make it smaller */
    .user-welcome,
    .opp-user-welcome {
        font-size: 0.8rem;
        opacity: 0.8;
    }
    
    /* ===============================
       BOTTOM TAB NAVIGATION
       =============================== */
    
    /* Create bottom navigation bar */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 70px;
        background: rgba(27, 67, 50, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(212, 175, 55, 0.2);
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 0 10px;
        /* iOS home indicator padding */
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        z-index: 1000;
        box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.3);
    }
    
    .mobile-tab-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 5px;
        border-radius: 12px;
        transition: all 0.3s ease;
        cursor: pointer;
        user-select: none;
        min-width: 50px;
        position: relative;
    }
    
    .mobile-tab-item.active {
        background: rgba(212, 175, 55, 0.15);
        transform: translateY(-2px);
    }
    
    .mobile-tab-item.active::before {
        content: '';
        position: absolute;
        top: -2px;
        left: 50%;
        transform: translateX(-50%);
        width: 30px;
        height: 3px;
        background: #D4AF37;
        border-radius: 0 0 3px 3px;
    }
    
    .mobile-tab-icon {
        width: 24px;
        height: 24px;
        margin-bottom: 4px;
        fill: rgba(255, 255, 255, 0.6);
        transition: all 0.3s ease;
    }
    
    .mobile-tab-item.active .mobile-tab-icon {
        fill: #D4AF37;
        transform: scale(1.1);
    }
    
    .mobile-tab-item.completed .mobile-tab-icon {
        fill: #52B788;
    }
    
    .mobile-tab-label {
        font-size: 0.6rem;
        color: rgba(255, 255, 255, 0.6);
        font-weight: 500;
        text-align: center;
        line-height: 1.2;
        transition: color 0.3s ease;
    }
    
    .mobile-tab-item.active .mobile-tab-label {
        color: #D4AF37;
        font-weight: 600;
    }
    
    .mobile-tab-item.completed .mobile-tab-label {
        color: #52B788;
    }
    
    /* Progress indicator on tab */
    .mobile-tab-progress {
        position: absolute;
        top: 2px;
        right: 2px;
        width: 8px;
        height: 8px;
        background: #D4AF37;
        border-radius: 50%;
        opacity: 0;
        transform: scale(0);
        transition: all 0.3s ease;
    }
    
    .mobile-tab-item.completed .mobile-tab-progress {
        opacity: 1;
        transform: scale(1);
        background: #52B788;
    }
    
    /* ===============================
       CONTENT AREA OPTIMIZATION
       =============================== */
    
    .content-area,
    .opp-content-area {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 0; /* Remove all padding for full width */
        overflow: visible;
        width: 100%;
    }
    
    /* Step content - FULL WIDTH */
    .onboarding-step {
        opacity: 0;
        transform: translateX(100%);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        padding: 15px 0; /* Remove side padding for full width */
        width: 100%;
    }
    
    .onboarding-step.active {
        opacity: 1;
        transform: translateX(0);
        position: relative;
    }
    
    .onboarding-step.prev {
        transform: translateX(-100%);
    }
    
    /* Focus content optimization - FULL WIDTH */
    .focus-content,
    .opp-focus-content {
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: none;
        border-radius: 0;
        padding: 20px 15px;
        margin: 0;
        box-shadow: none;
        width: 100%;
    }
    
    /* ===============================
       SENNA AVATAR & MESSAGING
       =============================== */
    
    .senna-avatar,
    .opp-senna-avatar {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: 2px solid #D4AF37;
        margin: 0 auto 15px;
        box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    }
    
    .senna-message-line,
    .opp-senna-message-line {
        font-size: 1.1rem;
        line-height: 1.5;
        color: #fff;
        text-align: center;
        margin-bottom: 20px;
        padding: 15px;
        background: rgba(212, 175, 55, 0.1);
        border-radius: 15px;
        border: 1px solid rgba(212, 175, 55, 0.2);
    }
    
    .welcome-message,
    .opp-welcome-message {
        font-size: 1.3rem;
        font-weight: 600;
        color: #fff;
        text-align: center;
        margin-bottom: 25px;
        line-height: 1.4;
    }
    
    /* ===============================
       INTERACTIVE ELEMENTS
       =============================== */
    
    /* Visual cards */
    .visual-cards-container,
    .opp-visual-cards-container {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 20px 0;
    }
    
    .visual-card,
    .opp-visual-card {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 15px;
        padding: 20px;
        text-align: center;
        transition: all 0.3s ease;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }
    
    .visual-card:hover,
    .opp-visual-card:hover,
    .visual-card:active,
    .opp-visual-card:active {
        background: rgba(212, 175, 55, 0.1);
        border-color: rgba(212, 175, 55, 0.3);
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(212, 175, 55, 0.2);
    }
    
    .visual-card.selected,
    .opp-visual-card.selected {
        background: rgba(212, 175, 55, 0.15);
        border-color: #D4AF37;
        box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.3);
    }
    
    /* Add ripple effect */
    .visual-card::after,
    .opp-visual-card::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(212, 175, 55, 0.3);
        transform: translate(-50%, -50%);
        transition: all 0.6s ease;
        pointer-events: none;
    }
    
    .visual-card:active::after,
    .opp-visual-card:active::after {
        width: 200px;
        height: 200px;
    }
    
    /* Buttons */
    .nav-button,
    .opp-nav-button {
        width: 100%;
        padding: 16px 24px;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 25px;
        border: none;
        cursor: pointer;
        transition: all 0.3s ease;
        margin: 8px 0;
        position: relative;
        overflow: hidden;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    
    .nav-button.primary,
    .opp-nav-button.primary {
        background: linear-gradient(135deg, #D4AF37 0%, #B8860B 100%);
        color: #1B4332;
    }
    
    .nav-button.primary:active,
    .opp-nav-button.primary:active {
        transform: translateY(1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .nav-button.secondary,
    .opp-nav-button.secondary {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    /* ===============================
       FORM ELEMENTS
       =============================== */
    
    .query-input,
    .opp-query-input,
    input[type="text"],
    input[type="email"] {
        width: 100%;
        padding: 16px 20px;
        font-size: 1rem;
        border: 2px solid rgba(255, 255, 255, 0.1);
        border-radius: 15px;
        background: rgba(255, 255, 255, 0.05);
        color: #fff;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        transition: all 0.3s ease;
        margin: 10px 0;
        box-sizing: border-box;
    }
    
    .query-input:focus,
    .opp-query-input:focus,
    input[type="text"]:focus,
    input[type="email"]:focus {
        outline: none;
        border-color: #D4AF37;
        background: rgba(255, 255, 255, 0.08);
        box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
    }
    
    .query-input::placeholder,
    .opp-query-input::placeholder,
    input::placeholder {
        color: rgba(255, 255, 255, 0.5);
    }
    
    /* ===============================
       SMOOTH ANIMATIONS
       =============================== */
    
    /* Page transitions */
    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateX(100%);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    @keyframes slideOutLeft {
        from {
            opacity: 1;
            transform: translateX(0);
        }
        to {
            opacity: 0;
            transform: translateX(-100%);
        }
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Apply animations */
    .focus-content > *,
    .opp-focus-content > * {
        animation: fadeInUp 0.6s ease forwards;
    }
    
    .focus-content > *:nth-child(2) { animation-delay: 0.1s; }
    .focus-content > *:nth-child(3) { animation-delay: 0.2s; }
    .focus-content > *:nth-child(4) { animation-delay: 0.3s; }
    
    /* ===============================
       HAPTIC FEEDBACK SIMULATION
       =============================== */
    
    .visual-card:active,
    .opp-visual-card:active,
    .nav-button:active,
    .opp-nav-button:active,
    .mobile-tab-item:active {
        transform: scale(0.98);
    }
    
    /* ===============================
       LOADING STATES
       =============================== */
    
    .loading-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 32, 39, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 10000;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
        border: 3px solid rgba(212, 175, 55, 0.2);
        border-top: 3px solid #D4AF37;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-bottom: 20px;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    .loading-text {
        color: #D4AF37;
        font-size: 1rem;
        font-weight: 500;
    }
    
    /* ===============================
       MICRO-INTERACTIONS
       =============================== */
    
    /* Typing cursor animation */
    .typing-cursor {
        animation: blink 1s infinite;
    }
    
    @keyframes blink {
        0%, 50% { opacity: 1; }
        51%, 100% { opacity: 0; }
    }
    
    /* Progress indicators */
    .progress-ring {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: conic-gradient(#D4AF37 var(--progress, 0%), rgba(255,255,255,0.1) 0%);
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }
    
    .progress-ring::after {
        content: '';
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #1B4332;
    }
    
}

/* ===============================
   LANDSCAPE ORIENTATION FIXES
   =============================== */

@media screen and (max-width: 767px) and (orientation: landscape) {
    .main-container,
    .opp-main-container {
        padding-bottom: 60px;
    }
    
    .mobile-bottom-nav {
        height: 50px;
        padding-bottom: 5px;
    }
    
    .mobile-tab-icon {
        width: 20px;
        height: 20px;
    }
    
    .mobile-tab-label {
        font-size: 0.55rem;
    }
}

/* ===============================
   DARK MODE ENHANCEMENTS
   =============================== */

@media screen and (max-width: 767px) and (prefers-color-scheme: dark) {
    .focus-content,
    .opp-focus-content {
        background: rgba(0, 0, 0, 0.3);
        border-color: rgba(255, 255, 255, 0.05);
    }
    
    .visual-card,
    .opp-visual-card {
        background: rgba(0, 0, 0, 0.2);
        border-color: rgba(255, 255, 255, 0.05);
    }
}

/* ===============================
   ACCESSIBILITY IMPROVEMENTS
   =============================== */

@media screen and (max-width: 767px) {
    /* Focus indicators */
    .mobile-tab-item:focus,
    .visual-card:focus,
    .opp-visual-card:focus,
    .nav-button:focus,
    .opp-nav-button:focus {
        outline: 2px solid #D4AF37;
        outline-offset: 2px;
    }
    
    /* High contrast mode */
    @media (prefers-contrast: high) {
        .mobile-bottom-nav {
            background: #000;
            border-top-color: #D4AF37;
        }
        
        .mobile-tab-icon {
            fill: #fff;
        }
        
        .mobile-tab-item.active .mobile-tab-icon {
            fill: #D4AF37;
        }
    }
    
    /* Reduced motion */
    @media (prefers-reduced-motion: reduce) {
        .onboarding-step,
        .visual-card,
        .opp-visual-card,
        .nav-button,
        .opp-nav-button,
        .mobile-tab-item {
            transition: none;
            animation: none;
        }
    }
}