/* ============================================
   Smith Image Studio - PWA & Mobile Styles
   Version: 2.0.0
   ============================================ */

/* ---------- PWA Install Button ---------- */
.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.pwa-install-btn svg {
    width: 18px;
    height: 18px;
}

/* ---------- Mobile Bottom Navigation ---------- */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--muted);
    transition: all 0.2s;
    min-height: 56px;
}

.mobile-nav-item.active {
    color: var(--accent);
}

.mobile-nav-item:active {
    background: rgba(99, 102, 241, 0.1);
}

.mobile-nav-icon {
    font-size: 1.25rem;
    line-height: 1;
    margin-bottom: 4px;
}

.mobile-nav-label {
    font-size: 0.625rem;
    font-weight: 500;
}

body.has-mobile-nav {
    padding-bottom: 80px;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast-notification {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-notification.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.toast-notification.warning {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.toast-notification.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* ---------- Update Notification ---------- */
.update-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 9999px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.update-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.update-notification button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.update-notification button:hover {
    background: var(--accent-hover);
}

/* ---------- Online/Offline Indicator ---------- */
body.offline::before {
    content: 'Offline Mode';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--warning);
    color: #000;
    text-align: center;
    padding: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 9999;
}

body.offline .navbar {
    top: 24px;
}

body.offline .page-header {
    padding-top: 144px;
}

/* ---------- Touch-Friendly Improvements ---------- */
@media (pointer: coarse) {
    /* Larger touch targets */
    .btn,
    .nav-link,
    .action-btn,
    .wallet,
    .upload-zone {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Larger slider thumb for touch */
    input[type=range]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    /* Prevent text selection on UI elements */
    .btn,
    .nav-link,
    .action-btn,
    .mobile-nav-item,
    .feature-card {
        user-select: none;
        -webkit-user-select: none;
    }
    
    /* Improve touch feedback */
    .btn:active,
    .action-btn:active,
    .feature-card:active {
        transform: scale(0.98);
    }
}

/* ---------- Mobile Responsive Breakpoints ---------- */
@media (max-width: 968px) {
    .pwa-install-btn {
        display: none;
    }
}

@media (max-width: 768px) {
    .mobile-nav {
        display: flex;
    }
    
    .navbar .nav-links {
        display: none;
    }
    
    /* Adjust main content for mobile nav */
    .page-header {
        padding-top: 100px;
    }
    
    .hero-home {
        padding: 140px 0 60px;
    }
    
    /* Stack tool layout */
    .tool-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .tool-preview {
        position: static;
        order: -1;
    }
    
    /* Adjust comparison slider for touch */
    .comparison-handle {
        width: 48px;
        height: 48px;
    }
    
    .comparison-slider {
        width: 6px;
    }
    
    /* Full-width buttons on mobile */
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Larger form inputs */
    input[type=number],
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 16px;
    }
    
    /* Toast on mobile */
    .toast-container {
        left: 16px;
        right: 16px;
        top: auto;
        bottom: 100px;
    }
    
    .toast-notification {
        width: 100%;
        transform: translateY(120%);
    }
    
    .toast-notification.show {
        transform: translateY(0);
    }
    
    /* Update notification on mobile */
    .update-notification {
        left: 16px;
        right: 16px;
        transform: translateY(100px);
        border-radius: 12px;
    }
    
    .update-notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .features {
        gap: 16px;
    }
    
    .feature-card {
        padding: 20px;
    }
    
    .tool-panel {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-box {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 16px;
    }
    
    .support-card {
        padding: 24px;
    }
    
    .wallets {
        grid-template-columns: 1fr;
    }
}

/* ---------- Standalone Mode (Installed PWA) ---------- */
@media (display-mode: standalone) {
    .navbar {
        padding-top: env(safe-area-inset-top, 0);
    }
    
    .page-header {
        padding-top: calc(120px + env(safe-area-inset-top, 0));
    }
    
    .pwa-install-btn {
        display: none !important;
    }
}

/* ---------- iOS Safari Specific ---------- */
@supports (-webkit-touch-callout: none) {
    /* iOS-specific styles */
    .mobile-nav {
        padding-bottom: max(env(safe-area-inset-bottom), 20px);
    }
    
    /* Smooth scrolling */
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- Safe Area Support (Notch Devices) ---------- */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }
    
    .mobile-nav {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ---------- Print Styles ---------- */
@media print {
    .navbar,
    .mobile-nav,
    .pwa-install-btn,
    .toast-container,
    .update-notification {
        display: none !important;
    }
    
    body {
        background: #fff;
        color: #000;
    }
}

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

/* ---------- Dark Mode (System Preference) ---------- */
@media (prefers-color-scheme: light) {
    /* Site is already dark-themed, but could add light theme here */
}

/* ---------- Orientation Lock Hint ---------- */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-home {
        padding: 100px 0 40px;
    }
    
    .mobile-nav {
        display: none;
    }
    
    body.has-mobile-nav {
        padding-bottom: 0;
    }
}