/* ============================================
   MOBILE-OPTIMIZED STYLES FOR PYLABS
   Beautiful first impression on mobile devices
   Encourages desktop usage for full experience
   ============================================ */

/* Mobile Detection Banner */
.mobile-welcome-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #6366f1 0%, #00d4aa 100%);
    padding: 16px;
    text-align: center;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.3);
    animation: slideDown 0.5s ease-out;
}

.mobile-welcome-banner h3 {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.mobile-welcome-banner p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
}

.mobile-cta-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.mobile-cta-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.mobile-cta-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.mobile-cta-btn.primary {
    background: #ffffff;
    color: #6366f1;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile Hero Section */
.mobile-hero {
    display: none;
    padding: 20px;
    background: linear-gradient(180deg, #111827 0%, #0a0f1a 100%);
    text-align: center;
    margin-top: 70px; /* Account for welcome banner */
}

.mobile-hero-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.mobile-hero h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #6ee7d3, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.mobile-hero-subtitle {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 20px;
    line-height: 1.5;
}

.mobile-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.mobile-feature {
    background: #1a2332;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.mobile-feature:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(110, 231, 211, 0.2);
    border-color: #6ee7d3;
}

.mobile-feature-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.mobile-feature-title {
    font-size: 12px;
    font-weight: 600;
    color: #6ee7d3;
    margin-bottom: 4px;
}

.mobile-feature-desc {
    font-size: 10px;
    color: #94a3b8;
    line-height: 1.4;
}

/* Mobile Preview Screenshots */
.mobile-screenshots {
    margin: 24px 0;
    padding: 20px;
    background: #111827;
    border-radius: 12px;
}

.mobile-screenshots h3 {
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 16px;
    text-align: center;
}

.screenshot-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.screenshot-item {
    flex: 0 0 85%;
    scroll-snap-align: center;
    background: #0a0f1a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 12px;
}

.screenshot-item img {
    width: 100%;
    border-radius: 6px;
    margin-bottom: 8px;
}

.screenshot-caption {
    font-size: 11px;
    color: #6ee7d3;
    font-weight: 600;
    text-align: center;
}

/* Mobile CTA Section */
.mobile-cta-section {
    padding: 24px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(0, 212, 170, 0.1));
    border: 1px solid #1e293b;
    border-radius: 12px;
    margin: 20px;
    text-align: center;
}

.mobile-cta-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 8px;
}

.mobile-cta-section p {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 16px;
    line-height: 1.5;
}

.mobile-cta-large {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #6366f1, #00d4aa);
    color: #ffffff;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    margin-bottom: 12px;
}

.mobile-cta-large:active {
    transform: scale(0.98);
}

.mobile-note {
    font-size: 11px;
    color: #64748b;
    font-style: italic;
}

/* Mobile Stats/Social Proof */
.mobile-stats {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: #111827;
    border-radius: 12px;
    margin: 20px;
}

.mobile-stat {
    text-align: center;
}

.mobile-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #6ee7d3;
    display: block;
}

.mobile-stat-label {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Mobile-Optimized Existing Elements */
@media (max-width: 768px) {
    /* Show mobile-specific elements */
    .mobile-welcome-banner,
    .mobile-hero {
        display: block;
    }
    
    /* Optimize top bar for mobile */
    .top-bar {
        height: auto;
        flex-wrap: wrap;
        padding: 8px 12px;
    }
    
    .nav-logo {
        height: 28px;
    }
    
    .breadcrumb {
        font-size: 11px;
        margin-left: 8px;
    }
    
    /* Simplify gamification bar on mobile */
    .gamification-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        font-size: 11px;
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }
    
    .gamification-bar > * {
        font-size: 10px !important;
        padding: 4px 8px;
    }
    
    .xp-bar-container {
        width: 100% !important;
        order: -1;
        margin-bottom: 4px;
    }
    
    /* Hide complex elements that don't work well on mobile */
    .reset-btn,
    .leaderboard-btn {
        display: none;
    }
    
    /* Optimize toolbar */
    .toolbar {
        flex-wrap: wrap;
        padding: 8px;
        gap: 6px;
    }
    
    .toolbar select,
    .toolbar button {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    /* Single column layout */
    .main-container {
        flex-direction: column;
        padding: 12px;
    }
    
    .left-panel {
        max-width: 100%;
        margin: 0;
    }
    
    .left-panel.shifted {
        margin-right: 0;
    }
    
    /* Optimize content sections */
    .content-section {
        padding: 16px;
        font-size: 13px;
        line-height: 1.6;
    }
    
    .section-heading {
        font-size: 18px;
        padding-left: 10px;
        margin-bottom: 12px;
    }
    
    /* Mobile-friendly code editor */
    .editor-container {
        margin: 12px 0;
    }
    
    .CodeMirror {
        font-size: 12px !important;
        height: 300px !important;
    }
    
    /* Optimize output panel */
    .output-panel {
        max-height: 250px;
        font-size: 11px;
    }
    
    /* Stack AI mentor on mobile */
    .right-panel {
        position: static !important;
        width: 100% !important;
        margin-top: 20px;
        max-height: none !important;
    }
    
    #aiMentorSection {
        position: static !important;
        height: auto !important;
    }
    
    .ai-mentor-header {
        font-size: 14px;
    }
    
    #chatMessages {
        max-height: 300px;
    }
    
    /* Optimize buttons */
    .action-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .action-btn,
    .secondary-btn {
        font-size: 11px;
        padding: 8px 12px;
        flex: 1 1 45%;
    }
    
    /* Auth overlay mobile optimization */
    .auth-card {
        width: 90%;
        max-width: none;
        padding: 24px;
    }
    
    .auth-logo {
        width: 60px;
        height: 60px;
    }
    
    .auth-title {
        font-size: 20px;
    }
    
    /* Diagram optimization */
    .diagram-card {
        padding: 8px;
        max-width: 100%;
    }
    
    .diagram-card svg {
        max-height: 200px;
        width: 100%;
    }
    
    /* Challenge card */
    .challenge-card {
        padding: 16px;
    }
    
    /* Modal optimization */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        padding: 20px;
    }
}

/* Extra small screens (< 375px) */
@media (max-width: 374px) {
    .mobile-hero h1 {
        font-size: 20px;
    }
    
    .mobile-features {
        grid-template-columns: 1fr;
    }
    
    .mobile-feature {
        padding: 12px;
    }
    
    .mobile-cta-section {
        padding: 16px;
        margin: 16px;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-welcome-banner {
        padding: 8px;
    }
    
    .mobile-hero {
        padding: 16px;
        margin-top: 50px;
    }
    
    .mobile-features {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .CodeMirror {
        height: 200px !important;
    }
}

/* Tablet (768px - 1024px) - Keep desktop experience */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Don't show mobile elements on tablets */
    .mobile-welcome-banner,
    .mobile-hero,
    .mobile-screenshots,
    .mobile-stats {
        display: none !important;
    }
    
    /* Slightly adjust desktop layout for tablets */
    .left-panel {
        max-width: 600px;
    }
    
    .gamification-bar {
        font-size: 12px;
    }
}
