/**
 * Premium Mobile App Design
 * LinkedIn/Kindle-inspired native app experience
 */

:root {
    --app-primary: #0A0A0A;
    --app-secondary: #FFFFFF;
    --app-accent: #C9A961;
    --app-surface: #FAFAFA;
    --app-text: #1A1A1A;
    --app-text-secondary: #6B7280;
    --app-border: rgba(0, 0, 0, 0.06);
    --app-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --app-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --app-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --safe-area-top: env(safe-area-inset-top, 20px);
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
    --tab-bar-height: 56px;
}

/* ============================================
   MOBILE APP CONTAINER
   ============================================ */

@media (max-width: 768px) {
    /* Reset body and html for proper scrolling */
    html, body {
        overflow-x: hidden !important;
        overflow-y: auto !important; /* Enable vertical scrolling */
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }
    
    /* Main app wrapper - FIXED TO ALLOW SCROLLING */
    .sffc-opportunities-wrapper {
        position: relative !important; /* Changed from fixed */
        min-height: 100vh !important;
        height: auto !important; /* Allow expansion */
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        background: var(--app-surface) !important;
        overflow: visible !important; /* Allow content to flow */
    }
    
    /* Hide desktop elements completely */
    .sffc-floating-menu-bar,
    .sffc-shortlist-floating,
    .conversation-stage,
    #currency-selector-container,
    .sffc-menu-toggle,
    .sffc-stage-menu,
    .sffc-user-header,
    .sffc-brand-text,
    .sffc-title-underline {
        display: none !important;
    }
    
    /* ============================================
       MOBILE APP HEADER - Minimal & Clean
       ============================================ */
    
    .sffc-opp-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 56px !important;
        padding: 0 16px !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-bottom: 1px solid var(--app-border) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        z-index: 1000 !important;
        box-shadow: var(--app-shadow-sm) !important;
    }
    
    /* App Logo - Minimal */
    .sffc-brand {
        flex: 0 0 auto !important;
        margin: 0 !important;
    }
    
    .sffc-brand-logo {
        width: 32px !important;
        height: 32px !important;
        background: var(--app-accent) !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .sffc-brand-s {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: white !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    }
    
    /* App Title - Center */
    .app-header-title {
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        font-size: 17px !important;
        font-weight: 600 !important;
        color: var(--app-text) !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
        letter-spacing: -0.01em !important;
    }
    
    /* Header Actions */
    .sffc-profile-actions {
        flex: 0 0 auto !important;
        display: flex !important;
        gap: 8px !important;
        margin: 0 !important;
    }
    
    .sffc-edit-profile-btn {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .sffc-edit-profile-btn span {
        display: none !important;
    }
    
    .sffc-edit-profile-btn svg {
        width: 20px !important;
        height: 20px !important;
        color: var(--app-text-secondary) !important;
    }
    
    /* Shortlist toggle in header */
    .sffc-shortlist-header-toggle {
        width: 32px !important;
        height: 32px !important;
        background: transparent !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* ============================================
       MOBILE CONTENT AREA - Scrollable
       ============================================ */
    
    .sffc-main-container {
        flex: 1 !important;
        overflow: visible !important; /* Changed from hidden to visible */
        padding: 0 !important;
        margin-top: 56px !important;
        margin-bottom: var(--tab-bar-height) !important;
        position: relative !important;
        height: auto !important; /* Allow natural height */
    }
    
    .sffc-conversational-view {
        height: auto !important; /* Changed from 100% to auto */
        min-height: calc(100vh - 56px - var(--tab-bar-height)) !important;
        display: flex !important;
        flex-direction: column !important;
        background: var(--app-surface) !important;
    }
    
    /* ============================================
       CHAT INTERFACE - Premium Mobile
       ============================================ */
    
    .sffc-chat-area {
        flex: 1 !important;
        overflow-y: visible !important; /* Changed to visible for natural flow */
        -webkit-overflow-scrolling: touch !important;
        padding: 16px !important;
        padding-bottom: 100px !important;
        scroll-behavior: smooth !important;
        height: auto !important; /* Allow natural height */
    }
    
    /* Messages - Clean and Readable */
    .senna-message {
        margin-bottom: 16px !important;
        animation: messageSlideUp 0.3s ease !important;
    }
    
    .sffc-message-user {
        display: flex !important;
        justify-content: flex-end !important;
    }
    
    .sffc-message-user .message-content {
        background: var(--app-accent) !important;
        color: white !important;
        padding: 12px 16px !important;
        border-radius: 18px 18px 4px 18px !important;
        max-width: 85% !important;
        font-size: 15px !important;
        line-height: 1.4 !important;
        box-shadow: var(--app-shadow-sm) !important;
    }
    
    .sffc-message-senna {
        display: flex !important;
        justify-content: flex-start !important;
    }
    
    .sffc-message-senna .message-content {
        background: white !important;
        color: var(--app-text) !important;
        padding: 12px 16px !important;
        border-radius: 18px 18px 18px 4px !important;
        max-width: 85% !important;
        font-size: 15px !important;
        line-height: 1.4 !important;
        box-shadow: var(--app-shadow-sm) !important;
        border: 1px solid var(--app-border) !important;
    }
    
    /* Job Cards in Chat - Single Column */
    .job-cards-in-chat {
        margin: 16px 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .job-card-vogue {
        background: white !important;
        border-radius: 12px !important;
        padding: 16px !important;
        border: 1px solid var(--app-border) !important;
        box-shadow: var(--app-shadow-sm) !important;
        transition: all 0.2s ease !important;
        cursor: pointer !important;
    }
    
    .job-card-vogue:active {
        transform: scale(0.98) !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    }
    
    .vogue-title {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: var(--app-text) !important;
        margin-bottom: 8px !important;
        line-height: 1.3 !important;
    }
    
    .vogue-company {
        font-size: 14px !important;
        color: var(--app-text-secondary) !important;
        margin-bottom: 8px !important;
    }
    
    .vogue-meta {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin: 8px 0 !important;
    }
    
    .vogue-meta-item {
        font-size: 13px !important;
        color: var(--app-text-secondary) !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }
    
    /* ============================================
       INPUT AREA - Fixed Bottom (Above Tab Bar)
       ============================================ */
    
    .senna-input-area {
        position: fixed !important;
        bottom: var(--tab-bar-height) !important;
        left: 0 !important;
        right: 0 !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-top: 1px solid var(--app-border) !important;
        padding: 12px 16px !important;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        z-index: 100 !important;
    }
    
    .senna-input-wrapper {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    #senna-input {
        flex: 1 !important;
        height: 40px !important;
        padding: 0 16px !important;
        background: var(--app-surface) !important;
        border: 1px solid var(--app-border) !important;
        border-radius: 20px !important;
        font-size: 15px !important;
        color: var(--app-text) !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
        transition: all 0.2s ease !important;
    }
    
    #senna-input:focus {
        outline: none !important;
        border-color: var(--app-accent) !important;
        background: white !important;
    }
    
    #senna-input::placeholder {
        color: var(--app-text-secondary) !important;
    }
    
    .senna-send-btn {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        background: var(--app-accent) !important;
        border: none !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
    }
    
    .senna-send-btn:active {
        transform: scale(0.9) !important;
    }
    
    .senna-send-btn svg {
        width: 20px !important;
        height: 20px !important;
        color: white !important;
    }
    
    /* ============================================
       BOTTOM TAB BAR - Native App Navigation
       ============================================ */
    
    .app-tab-bar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px)) !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-top: 1px solid var(--app-border) !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: space-around !important;
        padding-top: 8px !important;
        padding-bottom: env(safe-area-inset-bottom, 8px) !important;
        z-index: 1001 !important;
    }
    
    .tab-item {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        padding: 4px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .tab-item svg {
        width: 24px !important;
        height: 24px !important;
        color: var(--app-text-secondary) !important;
        transition: all 0.2s ease !important;
    }
    
    .tab-item span {
        font-size: 10px !important;
        color: var(--app-text-secondary) !important;
        font-weight: 500 !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
        transition: all 0.2s ease !important;
    }
    
    .tab-item.active svg,
    .tab-item.active span {
        color: var(--app-accent) !important;
    }
    
    .tab-item:active {
        transform: scale(0.95) !important;
    }
    
    /* Tab indicator dot */
    .tab-item.has-notification::after {
        content: '';
        position: absolute;
        top: 4px;
        right: calc(50% - 16px);
        width: 6px;
        height: 6px;
        background: #FF3B30;
        border-radius: 50%;
    }
    
    /* ============================================
       SEARCH BAR - Integrated Mobile Search
       ============================================ */
    
    .sffc-message-search {
        display: none !important; /* Hide default search */
    }
    
    .app-search-bar {
        position: sticky;
        top: 56px;
        z-index: 99;
        background: var(--app-surface);
        padding: 12px 16px;
        border-bottom: 1px solid var(--app-border);
    }
    
    .app-search-input {
        width: 100%;
        height: 36px;
        padding: 0 36px 0 12px;
        background: white;
        border: 1px solid var(--app-border);
        border-radius: 18px;
        font-size: 14px;
        color: var(--app-text);
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }
    
    .app-search-input:focus {
        outline: none;
        border-color: var(--app-accent);
    }
    
    .app-search-icon {
        position: absolute;
        right: 28px;
        top: 50%;
        transform: translateY(-50%);
        width: 16px;
        height: 16px;
        color: var(--app-text-secondary);
        pointer-events: none;
    }
    
    /* ============================================
       QUICK ACTIONS - Floating Action Buttons
       ============================================ */
    
    .quick-action-cards {
        display: flex !important;
        gap: 8px !important;
        padding: 0 16px 16px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    
    .quick-action-cards::-webkit-scrollbar {
        display: none !important;
    }
    
    .quick-action-card {
        flex: 0 0 auto !important;
        padding: 10px 16px !important;
        background: white !important;
        border: 1px solid var(--app-border) !important;
        border-radius: 20px !important;
        font-size: 14px !important;
        color: var(--app-text) !important;
        white-space: nowrap !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .quick-action-card:active {
        background: var(--app-accent) !important;
        color: white !important;
        transform: scale(0.95) !important;
    }
    
    /* ============================================
       PROFILE BUILDER - Full Screen Modal
       ============================================ */
    
    .sffc-profile-builder-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: var(--app-surface) !important;
        z-index: 2000 !important;
        transform: translateY(100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    .sffc-profile-builder-overlay.active {
        transform: translateY(0) !important;
    }
    
    /* ============================================
       ANIMATIONS
       ============================================ */
    
    @keyframes messageSlideUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    @keyframes pulseOnce {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.05); }
    }
    
    /* ============================================
       LOADING STATES
       ============================================ */
    
    .typing-indicator {
        display: flex !important;
        gap: 4px !important;
        padding: 12px 16px !important;
        background: white !important;
        border-radius: 18px !important;
        border: 1px solid var(--app-border) !important;
        width: fit-content !important;
    }
    
    .typing-dot {
        width: 8px !important;
        height: 8px !important;
        background: var(--app-text-secondary) !important;
        border-radius: 50% !important;
        animation: typingDot 1.4s infinite !important;
    }
    
    .typing-dot:nth-child(2) {
        animation-delay: 0.2s !important;
    }
    
    .typing-dot:nth-child(3) {
        animation-delay: 0.4s !important;
    }
    
    @keyframes typingDot {
        0%, 60%, 100% {
            transform: translateY(0);
            opacity: 0.4;
        }
        30% {
            transform: translateY(-10px);
            opacity: 1;
        }
    }
    
    /* ============================================
       GESTURE HINTS
       ============================================ */
    
    .swipe-hint {
        position: absolute;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 13px;
        animation: fadeInOut 3s ease;
        pointer-events: none;
    }
    
    @keyframes fadeInOut {
        0%, 100% { opacity: 0; }
        20%, 80% { opacity: 1; }
    }
    
    /* ============================================
       TOUCH OPTIMIZATIONS
       ============================================ */
    
    /* Ensure all tappable elements are at least 44x44px */
    button, .tab-item, .quick-action-card, .job-card-vogue {
        min-height: 44px !important;
        position: relative !important;
    }
    
    /* Prevent text selection on interactive elements */
    button, .tab-item, .quick-action-card {
        -webkit-user-select: none !important;
        user-select: none !important;
    }
    
    /* Smooth scrolling everywhere */
    * {
        scroll-behavior: smooth !important;
    }
    
    /* Remove tap highlight */
    * {
        -webkit-tap-highlight-color: transparent !important;
    }
    
    /* ============================================
       SHORTLIST DROPDOWN - Mobile Optimized
       ============================================ */
    
    .sffc-shortlist-dropdown {
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        background: var(--app-surface) !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    .sffc-shortlist-dropdown.active {
        transform: translateX(0) !important;
    }
    
    .sffc-shortlist-dropdown-header {
        position: sticky !important;
        top: 0 !important;
        background: white !important;
        border-bottom: 1px solid var(--app-border) !important;
        padding: 16px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .sffc-shortlist-dropdown-content {
        padding: 16px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        height: calc(100% - 60px) !important;
    }
}