/* Mobile Responsive Styles for Wplace Paint Tool */
/* Preserves PC layout while optimizing for mobile */

/* ================================
   Breakpoints:
   - Large Desktop: > 1400px (unchanged)
   - Desktop: 1024px - 1400px (unchanged)
   - Tablet: 768px - 1023px
   - Mobile: < 768px
   ================================ */

/* ================================
   MOBILE NAVIGATION
   ================================ */
@media (max-width: 768px) {
    /* Header Adjustments */
    .app-header {
        padding: 0;
        height: 60px;
    }
    
    .header-content {
        padding: 0 1rem;
        height: 60px;
    }
    
    .logo {
        font-size: 1.25rem;
        gap: 0.5rem;
    }
    
    .logo i {
        width: 24px !important;
        height: 24px !important;
    }
    
    /* Mobile Navigation Menu */
    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 2rem 1rem;
        gap: 0;
        transition: left 0.3s ease;
        z-index: 999;
        overflow-y: auto;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        width: 100%;
        padding: 1rem;
        border-radius: 12px;
        font-size: 1rem;
        justify-content: flex-start;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    /* Hamburger Menu Button */
    .mobile-menu-toggle {
        display: flex !important;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        margin-left: auto;
    }
    
    .mobile-menu-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: var(--gray-900);
        margin: 4px 0;
        transition: all 0.3s;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
}

/* Desktop - Hide mobile menu toggle */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }
}

/* ================================
   MAIN CONTENT - MOBILE
   ================================ */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
        margin: 1rem auto;
    }
    
    /* Converter Layout - Stack vertically on mobile */
    .converter-layout {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    /* Left Panel */
    .left-panel {
        position: static !important;
        width: 100%;
    }
    
    /* Upload Box */
    .upload-box {
        padding: 2rem 1rem;
    }
    
    .upload-box h2 {
        font-size: 18px !important;
    }
    
    .upload-box p {
        font-size: 14px;
    }
    
    /* Settings Section */
    .settings-section {
        padding: 1rem;
    }
    
    .section-title {
        font-size: 18px !important;
    }
    
    /* Sliders and Controls */
    .slider-premium {
        height: 40px;
    }
    
    .setting-group {
        margin-bottom: 1.5rem;
    }
    
    /* Color Palette */
    .palette-section {
        padding: 1rem;
    }
    
    .palette-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 4px;
    }
    
    .color-chip {
        width: 100%;
        aspect-ratio: 1;
    }
    
    /* Right Panel - Preview */
    .right-panel {
        min-height: auto;
    }
    
    .preview-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .preview-header h2 {
        font-size: 20px !important;
    }
    
    .preview-actions {
        width: 100%;
        justify-content: space-around;
    }
    
    /* Canvas Container */
    .canvas-wrapper {
        padding: 1rem;
        max-height: 400px;
    }
    
    #canvas, #originalCanvas, #outputCanvas {
        max-width: 100%;
        height: auto !important;
    }
    
    /* Toolbar Mobile Optimization */
    .toolbar {
        padding: 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .tool-group {
        gap: 0.25rem;
    }
    
    .tool-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }
    
    .tool-separator {
        display: none;
    }
    
    .brush-settings {
        width: 100%;
        justify-content: center;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .brush-slider {
        max-width: 120px;
    }
    
    /* Zoom Controls Mobile */
    .zoom-controls {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .zoom-slider {
        max-width: 100px;
    }
    
    /* Color Analysis Mobile */
    .color-analysis {
        padding: 1rem;
    }
    
    .analysis-header {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .color-stats {
        width: 100%;
        justify-content: space-around;
    }
    
    .used-colors-grid {
        gap: 4px;
    }
    
    /* Empty State */
    .empty-state {
        padding: 3rem 1rem;
    }
    
    .empty-state svg {
        width: 80px;
        height: 80px;
    }
    
    .empty-state h3 {
        font-size: 1.25rem;
    }
}

/* ================================
   PREMIUM SECTIONS - MOBILE
   ================================ */
@media (max-width: 768px) {
    .premium-section {
        padding: 40px 0 !important;
    }
    
    .premium-hero {
        padding: 60px 20px !important;
    }
    
    .premium-hero-title {
        font-size: 1.75rem !important;
    }
    
    .premium-hero-subtitle {
        font-size: 1rem !important;
    }
    
    /* Feature Grid */
    .premium-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .premium-grid-3 {
        grid-template-columns: 1fr !important;
    }
    
    .premium-feature-card {
        padding: 1.5rem;
    }
    
    .premium-feature-icon {
        width: 60px;
        height: 60px;
    }
    
    .premium-feature-title {
        font-size: 1.125rem;
    }
    
    /* Blog Cards */
    .premium-blog-card {
        padding: 1.5rem;
    }
    
    .premium-blog-title {
        font-size: 1.125rem;
    }
    
    .premium-blog-excerpt {
        font-size: 0.875rem;
    }
    
    /* CTA Section */
    .premium-cta {
        padding: 60px 20px !important;
    }
    
    .premium-cta h2 {
        font-size: 2rem !important;
    }
    
    .premium-cta p {
        font-size: 1rem !important;
    }
}

/* ================================
   FOOTER - MOBILE
   ================================ */
@media (max-width: 768px) {
    .footer-modern {
        padding: 40px 0 20px !important;
    }
    
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    
    .footer-brand h3 {
        font-size: 20px !important;
    }
    
    .footer-column h4 {
        font-size: 14px !important;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-bottom p {
        font-size: 12px !important;
    }
}

/* ================================
   BLOG PAGE - MOBILE
   ================================ */
@media (max-width: 768px) {
    /* Blog Article */
    .blog-article {
        padding: 30px 20px !important;
        margin: 20px !important;
        border-radius: 16px !important;
    }
    
    .article-title {
        font-size: 1.75rem !important;
    }
    
    .article-content {
        font-size: 1rem !important;
    }
    
    .article-content h2 {
        font-size: 1.5rem !important;
    }
    
    .article-content h3 {
        font-size: 1.25rem !important;
    }
    
    /* Blog Grid */
    .blog-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Featured Post */
    article.premium-glass > div {
        flex-direction: column !important;
        gap: 20px !important;
    }
    
    article.premium-glass .premium-feature-icon {
        width: 80px !important;
        height: 80px !important;
    }
}

/* ================================
   FORMS & INPUTS - MOBILE
   ================================ */
@media (max-width: 768px) {
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    .form-submit {
        padding: 14px 24px;
        font-size: 16px;
    }
    
    .contact-container {
        grid-template-columns: 1fr !important;
        padding: 30px 15px !important;
    }
    
    .contact-form-section {
        padding: 30px 20px !important;
    }
    
    .contact-info-section {
        padding: 30px 20px !important;
    }
}

/* ================================
   LEGAL PAGES - MOBILE
   ================================ */
@media (max-width: 768px) {
    .legal-content {
        padding: 30px 20px !important;
        margin: 20px !important;
    }
    
    .legal-title {
        font-size: 2rem !important;
    }
    
    .legal-section h2 {
        font-size: 1.5rem !important;
    }
    
    .legal-section h3 {
        font-size: 1.25rem !important;
    }
    
    .legal-section ul {
        padding: 16px !important;
    }
}

/* ================================
   TABLET OPTIMIZATIONS
   ================================ */
@media (min-width: 769px) and (max-width: 1023px) {
    /* Converter Layout */
    .converter-layout {
        grid-template-columns: 350px 1fr;
        gap: 1.5rem;
    }
    
    /* Navigation */
    .nav-menu {
        gap: 0.25rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    /* Premium Sections */
    .premium-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .premium-section {
        padding: 60px 20px;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr !important;
    }
}

/* ================================
   UTILITY CLASSES - MOBILE
   ================================ */
@media (max-width: 768px) {
    /* Hide elements on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Show elements only on mobile */
    .show-mobile {
        display: block !important;
    }
    
    /* Text adjustments */
    .text-mobile-center {
        text-align: center !important;
    }
    
    /* Spacing adjustments */
    .p-mobile-1 {
        padding: 1rem !important;
    }
    
    .m-mobile-0 {
        margin: 0 !important;
    }
}

/* ================================
   ANIMATIONS - MOBILE
   ================================ */
@media (max-width: 768px) {
    /* Reduce motion for better performance */
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
    
    /* Simplify animations on mobile */
    .fadeIn,
    .slideUp,
    .zoomIn {
        animation-duration: 0.3s !important;
    }
}

/* ================================
   TOUCH OPTIMIZATIONS
   ================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button,
    .btn,
    .nav-link,
    .action-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-link:hover {
        transform: none !important;
    }
    
    /* Improve tap highlight */
    button,
    a,
    input,
    textarea,
    select {
        -webkit-tap-highlight-color: rgba(16, 185, 129, 0.1);
    }
}

/* ================================
   LANDSCAPE MODE - MOBILE
   ================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .app-header {
        height: 50px;
    }
    
    .header-content {
        height: 50px;
    }
    
    .nav-menu {
        top: 50px;
        height: calc(100vh - 50px);
    }
    
    .premium-hero {
        padding: 40px 20px !important;
    }
    
    .canvas-wrapper {
        max-height: 300px;
    }
}

/* ================================
   PRINT STYLES
   ================================ */
@media print {
    .app-header,
    .footer-modern,
    .share-fab-container,
    .nav-menu,
    .preview-actions {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .panel-card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}