/**
 * Premium Responsive Styles
 * Phase 6: Mobile and Tablet Optimization
 * 
 * @package SENNA_Launcher
 * @since 4.0.0
 */

/* ===========================================
   RESPONSIVE BREAKPOINTS
   =========================================== */

/* 
 * Breakpoint System:
 * - Mobile: 320px - 767px
 * - Tablet: 768px - 1023px
 * - Desktop: 1024px - 1439px
 * - Large Desktop: 1440px+
 */

/* ===========================================
   TABLET STYLES (768px - 1023px)
   =========================================== */

@media screen and (max-width: 1023px) {
    
    /* Container Adjustments */
    .opportunities-launcher-container,
    .opp-launcher-container {
        padding: 20px;
    }
    
    .main-container,
    .opp-main-container {
        width: 90%;
        max-width: 720px;
        padding: 30px 20px;
    }
    
    /* Header Adjustments */
    .header-container,
    .opp-header-container {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .journey-progress,
    .opp-journey-progress {
        width: 100%;
        justify-content: center;
    }
    
    /* Cards Grid */
    .visual-cards-container,
    .opp-visual-cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* Typography Scaling */
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    /* Profile Card */
    .profile-grid,
    .opp-profile-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Opportunity Cards */
    .opportunities-list,
    .opp-opportunities-list {
        grid-template-columns: 1fr;
    }
    
    /* Form Adjustments */
    .query-input-wrapper,
    .opp-query-input-wrapper {
        flex-direction: column;
    }
    
    .query-input,
    .opp-query-input {
        width: 100%;
    }
    
    .query-submit,
    .opp-query-submit {
        width: 100%;
        margin-top: 10px;
    }
}

/* ===========================================
   MOBILE STYLES (320px - 767px)
   =========================================== */

@media screen and (max-width: 767px) {
    
    /* Container Full Width */
    .main-container,
    .opp-main-container {
        width: 95%;
        max-width: none;
        padding: 20px 15px;
        border-radius: 20px;
        margin: 10px auto;
    }
    
    /* Header Mobile Layout */
    .header-container,
    .opp-header-container {
        padding: 15px;
    }
    
    .logo-section,
    .opp-logo-section {
        justify-content: center;
    }
    
    .journey-progress,
    .opp-journey-progress {
        overflow-x: auto;
        padding: 10px 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .journey-step,
    .opp-journey-step {
        min-width: 60px;
        font-size: 0.75rem;
    }
    
    /* Single Column Cards */
    .visual-cards-container,
    .opp-visual-cards-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .visual-card,
    .opp-visual-card {
        padding: 20px;
        min-height: auto;
    }
    
    /* Typography Mobile */
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }
    
    h2 {
        font-size: 1.35rem !important;
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 1.15rem !important;
        line-height: 1.3 !important;
    }
    
    body,
    p {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }
    
    /* Senna Avatar Mobile */
    .senna-avatar,
    .opp-senna-avatar {
        width: 60px;
        height: 60px;
    }
    
    /* Welcome Message Mobile */
    .welcome-message,
    .opp-welcome-message {
        padding: 15px;
        font-size: 0.9rem;
    }
    
    /* Query Panel Mobile */
    .query-panel,
    .opp-query-panel {
        padding: 20px 15px;
    }
    
    .query-input,
    .opp-query-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 15px;
    }
    
    /* Quick Questions Mobile */
    .quick-questions,
    .opp-quick-questions {
        flex-direction: column;
        gap: 10px;
    }
    
    .quick-question,
    .opp-quick-question {
        width: 100%;
        text-align: center;
        padding: 10px 15px;
    }
    
    /* Buttons Mobile */
    .action-btn,
    .apply-btn,
    .opp-action-btn,
    .opp-apply-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.95rem;
    }
    
    /* Report Sections Mobile */
    .report-section,
    .opp-report-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* Market Intel Mobile */
    .intel-item,
    .opp-intel-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    /* Network Cards Mobile */
    .network-cards,
    .opp-network-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Premium Plan Card Mobile */
    .premium-plan-card,
    .opp-premium-plan-card {
        padding: 20px 15px;
    }
    
    .unlock-premium-btn,
    .opp-unlock-premium-btn {
        width: 100%;
        padding: 14px;
    }
    
    /* Form Fields Mobile */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px !important;
    }
    
    /* Modal/Overlay Mobile */
    .launcher-overlay,
    .opp-launcher-overlay {
        padding: 10px;
    }
    
    /* Steps Navigation Mobile */
    .onboarding-step,
    .opp-onboarding-step {
        padding: 20px 10px;
    }
    
    /* Priority Actions Mobile */
    .priority-action,
    .opp-priority-action {
        flex-direction: column;
        text-align: center;
    }
    
    .action-number,
    .opp-action-number {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

/* ===========================================
   SMALL MOBILE (320px - 479px)
   =========================================== */

@media screen and (max-width: 479px) {
    
    /* Ultra Compact Layout */
    .main-container,
    .opp-main-container {
        width: 100%;
        border-radius: 0;
        margin: 0;
        min-height: 100vh;
    }
    
    .launcher-overlay,
    .opp-launcher-overlay {
        padding: 0;
    }
    
    /* Smaller Typography */
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    /* Compact Journey Steps */
    .journey-step,
    .opp-journey-step {
        min-width: 50px;
    }
    
    .step-circle,
    .opp-step-circle {
        width: 25px;
        height: 25px;
        font-size: 0.7rem;
    }
    
    /* Smaller Avatar */
    .senna-avatar,
    .opp-senna-avatar {
        width: 50px;
        height: 50px;
    }
    
    /* Compact Cards */
    .visual-card,
    .opp-visual-card {
        padding: 15px;
    }
    
    .visual-card-icon,
    .opp-visual-card-icon {
        font-size: 1.5rem;
    }
}

/* ===========================================
   LANDSCAPE MOBILE (568px height max)
   =========================================== */

@media screen and (max-height: 568px) and (orientation: landscape) {
    
    /* Reduce Vertical Spacing */
    .main-container,
    .opp-main-container {
        padding: 15px;
    }
    
    .header-container,
    .opp-header-container {
        padding: 10px;
    }
    
    .visual-cards-container,
    .opp-visual-cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .visual-card,
    .opp-visual-card {
        padding: 15px;
        min-height: auto;
    }
    
    /* Compact Typography */
    h1, h2, h3 {
        margin: 10px 0 !important;
    }
    
    /* Hide Non-Essential Elements */
    .decorative-element {
        display: none;
    }
}

/* ===========================================
   TOUCH OPTIMIZATIONS
   =========================================== */

@media (hover: none) and (pointer: coarse) {
    
    /* Larger Touch Targets */
    button,
    .action-btn,
    .apply-btn,
    .visual-card,
    .quick-question,
    a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove Hover Effects on Touch */
    .visual-card:hover,
    .opp-visual-card:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
    
    /* Active States for Touch */
    .visual-card:active,
    .opp-visual-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    button:active,
    .action-btn:active,
    .apply-btn:active {
        transform: scale(0.98);
    }
    
    /* Disable Text Selection on Interactive Elements */
    .visual-card,
    .quick-question,
    button {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Smooth Scrolling */
    .scrollable-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* ===========================================
   HIGH DPI SCREENS
   =========================================== */

@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    
    /* Crisp Borders */
    .visual-card,
    .opp-visual-card,
    .profile-card,
    .opp-profile-card {
        border-width: 0.5px;
    }
    
    /* Sharper Shadows */
    .premium-shadow {
        box-shadow: 
            0 0.5px 1.5px rgba(13, 53, 62, 0.04),
            0 2px 4px rgba(13, 53, 62, 0.02),
            0 4px 8px rgba(13, 53, 62, 0.01);
    }
}

/* ===========================================
   PRINT STYLES
   =========================================== */

@media print {
    
    /* Hide Interactive Elements */
    .launcher-overlay,
    .journey-progress,
    button,
    .action-btn,
    .apply-btn {
        display: none !important;
    }
    
    /* Full Width for Print */
    .main-container,
    .opp-main-container {
        width: 100%;
        max-width: none;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    /* Black and White */
    * {
        color: #000 !important;
        background: #fff !important;
    }
    
    /* Ensure Readability */
    body {
        font-size: 12pt !important;
        line-height: 1.5 !important;
    }
    
    h1 { font-size: 18pt !important; }
    h2 { font-size: 16pt !important; }
    h3 { font-size: 14pt !important; }
    
    /* Page Breaks */
    .report-section,
    .opp-report-section {
        page-break-inside: avoid;
    }
}

/* ===========================================
   ACCESSIBILITY RESPONSIVE
   =========================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===========================================
   CONTAINER QUERIES (Future CSS)
   =========================================== */

@supports (container-type: inline-size) {
    .main-container {
        container-type: inline-size;
    }
    
    @container (max-width: 600px) {
        .visual-cards-container {
            grid-template-columns: 1fr;
        }
    }
}

/* ===========================================
   SAFE AREA INSETS (iPhone X+)
   =========================================== */

@supports (padding: max(0px)) {
    .main-container,
    .opp-main-container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* ===========================================
   RESPONSIVE UTILITIES
   =========================================== */

/* Hide on Mobile */
@media screen and (max-width: 767px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
}

/* Hide on Tablet */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .hide-tablet { display: none !important; }
    .show-tablet { display: block !important; }
}

/* Hide on Desktop */
@media screen and (min-width: 1024px) {
    .hide-desktop { display: none !important; }
    .show-desktop { display: block !important; }
}

/* Text Alignment Responsive */
@media screen and (max-width: 767px) {
    .text-center-mobile { text-align: center !important; }
    .text-left-mobile { text-align: left !important; }
    .text-right-mobile { text-align: right !important; }
}

/* Flexbox Responsive */
@media screen and (max-width: 767px) {
    .flex-column-mobile {
        flex-direction: column !important;
    }
    
    .flex-wrap-mobile {
        flex-wrap: wrap !important;
    }
}

/* Spacing Responsive */
@media screen and (max-width: 767px) {
    .p-0-mobile { padding: 0 !important; }
    .m-0-mobile { margin: 0 !important; }
    .mt-3-mobile { margin-top: 1rem !important; }
    .mb-3-mobile { margin-bottom: 1rem !important; }
}