/* ============================================
   ADDITIONAL MOBILE UX ENHANCEMENTS
   ============================================ */

/* Better touch targets for all interactive elements */
@media (hover: none) and (pointer: coarse) {
    /* All clickable elements should be minimum 44x44px */
    a, button, input[type="submit"], input[type="button"], 
    .nav-link, .btn, .feature-card, .card {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Prevent zoom on input focus (iOS) */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Larger tap areas for icons */
    .header-btn,
    .theme-control-btn,
    .language-btn {
        padding: 12px !important;
        min-width: 48px !important;
        min-height: 48px !important;
    }
}

/* Mobile-specific spacing improvements */
@media (max-width: 768px) {
    /* Add breathing room */
    section {
        padding: 2rem 1rem !important;
    }
    
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* MOBILE HEADER - CLEAN & SIMPLE */
    .modern-header {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    .header-container {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    .header-right {
        display: flex !important;
        gap: 0.75rem !important;
        align-items: center !important;
    }
    
    /* HIDE these elements from header - they go in mobile menu */
    .header-right .header-btn,
    .header-right .language-switcher,
    .header-right .theme-selector {
        display: none !important;
    }
    
    /* KEEP ONLY these in header */
    .login-btn,
    .mobile-menu-btn,
    #header-user-info {
        display: flex !important;
        flex-shrink: 0 !important;
    }
    
    .login-btn {
        padding: 10px 20px !important;
        font-size: 1rem !important;
    }
    
    .mobile-menu-btn {
        min-width: 48px !important;
        min-height: 48px !important;
    }
    
    /* MOBILE MENU - Add controls inside */
    .mobile-menu {
        padding-bottom: 2rem;
    }
    
    .mobile-menu .mobile-menu-controls {
        display: block !important;
        padding: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 1rem;
    }
    
    .mobile-menu .mobile-menu-controls > div {
        margin-bottom: 1rem;
    }
    
    .mobile-menu .mobile-menu-controls .control-label {
        display: block;
        color: rgba(255, 255, 255, 0.7);
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Search in mobile menu */
    .mobile-menu .header-btn {
        display: flex !important;
        width: 100%;
        padding: 12px !important;
        justify-content: flex-start;
        gap: 0.75rem;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        color: rgba(255, 255, 255, 0.9);
        font-size: 1rem;
        text-align: left;
    }
    
    /* Language switcher in mobile menu */
    .mobile-menu .language-switcher {
        display: block !important;
    }
    
    .mobile-menu .language-btn {
        display: flex !important;
        width: 100%;
        padding: 12px !important;
        justify-content: space-between;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        font-size: 1rem;
    }
    
    /* Theme controls in mobile menu */
    .mobile-menu .theme-selector {
        display: block !important;
    }
    
    .mobile-menu .theme-selector {
        display: flex !important;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mobile-menu .theme-control-btn {
        display: flex !important;
        width: 100%;
        padding: 12px !important;
        justify-content: flex-start;
        gap: 0.75rem;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        font-size: 1rem;
        text-align: left;
    }
    
    .mobile-menu .theme-control-btn::after {
        content: attr(title);
        margin-left: 0.5rem;
    }
    
    /* Dropdowns in mobile menu */
    .mobile-menu .language-dropdown,
    .mobile-menu .theme-dropdown {
        position: static !important;
        display: none;
        margin-top: 0.5rem;
        box-shadow: none !important;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-menu .language-dropdown[style*="display: block"],
    .mobile-menu .theme-dropdown[style*="display: block"] {
        display: block !important;
    }
    
    /* Hero section mobile fixes */
    .hero-section {
        padding: 2rem 1rem !important;
        overflow: hidden;
    }
    
    .hero-overlay {
        padding: 1rem !important;
        width: 100%;
    }
    
    .hero-slogan {
        padding: 15px 20px !important;
        font-size: 1.5rem !important;
        line-height: 1.4 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        text-align: center !important;
    }
    
    .hero-signature {
        margin-top: 1rem;
        font-size: 1rem !important;
    }
    
    /* Stack grid items */
    .cards-grid,
    .feature-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Full-width buttons on mobile */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Better modal sizing */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Responsive images */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Hide decorative elements on mobile */
    .desktop-only {
        display: none !important;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .cards-grid,
    .feature-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Landscape phone improvements */
@media (max-width: 896px) and (orientation: landscape) {
    .modern-header {
        padding: 0.5rem 1rem;
    }
    
    .modal-dialog {
        max-height: 85vh;
    }
}

/* Extra small mobile devices (320px-420px) - Content optimizations */
@media (max-width: 420px) {
    .hero-slogan {
        font-size: 1.3rem !important;
        padding: 12px 15px !important;
        line-height: 1.3 !important;
    }
    
    .section-title {
        font-size: 1.2rem !important;
        padding: 12px 20px !important;
    }
    
    .feature-card h3 {
        font-size: 1.1rem !important;
    }
    
    /* Force single column on small screens */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   SMOOTH SCROLLING & ANIMATIONS
   ============================================ */

/* Smooth scroll for anchor links */
html {
    scroll-behavior: smooth;
}

/* Fade in on scroll (optional - can be enabled with JS) */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 107, 53, 0.3);
    border-radius: 50%;
    border-top-color: #ff6b35;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--bs-primary);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .modern-header,
    .modern-footer,
    .mobile-menu,
    .theme-selector,
    .btn,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
}

/* ============================================
   DARK MODE IMPROVEMENTS
   ============================================ */

/* Better contrast for dark mode */
body[data-theme*="dark"] {
    color-scheme: dark;
}

body[data-theme*="dark"] ::selection {
    background: rgba(255, 107, 53, 0.5);
    color: white;
}

/* Light mode improvements */
body[data-theme*="light"] {
    color-scheme: light;
}

body[data-theme*="light"] ::selection {
    background: rgba(255, 107, 53, 0.3);
    color: #1a1a1a;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Optimize animations */
@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;
    }
}

/* GPU acceleration */
.card,
.btn,
.modal,
.dropdown-menu {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Lazy load images */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Spacing utilities (consistent with Bootstrap) */
.mt-mobile { margin-top: 1rem; }
.mb-mobile { margin-bottom: 1rem; }
.pt-mobile { padding-top: 1rem; }
.pb-mobile { padding-bottom: 1rem; }

@media (max-width: 768px) {
    .text-mobile-center { text-align: center; }
    .w-mobile-100 { width: 100%; }
    .d-mobile-block { display: block !important; }
    .d-mobile-none { display: none !important; }
}

/* Text utilities */
.text-glow {
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.5);
}

.text-primary {
    color: var(--bs-primary) !important;
}

/* Background utilities */
.bg-gradient-primary {
    background: linear-gradient(135deg, #ff6b35, #e55a2b);
}

.bg-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Shadow utilities */
.shadow-primary {
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.shadow-primary-lg {
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
}

/* ============================================
   CUSTOM SCROLLBAR (Webkit browsers)
   ============================================ */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.5);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.7);
    background-clip: padding-box;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 107, 53, 0.5) rgba(0, 0, 0, 0.1);
}

/* ============================================
   STATUS INDICATORS
   ============================================ */

/* Online/offline status */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-online { background: #4caf50; }
.status-offline { background: #9e9e9e; }
.status-busy { background: #ff9800; }
.status-away { background: #ffc107; }

/* Notification badge */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #f44336;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: rgba(255, 255, 255, 0.6);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.empty-state-text {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}
