/* Responsive CSS for Geoprep - Clean and Optimized */

/* Base responsive utilities */
.container {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin-left: auto;
    margin-right: auto;
}

/* Container breakpoints */
@media (min-width: 640px) {
    .container { max-width: 640px; }
}

@media (min-width: 768px) {
    .container { max-width: 768px; }
}

@media (min-width: 1024px) {
    .container { max-width: 1024px; }
}

@media (min-width: 1280px) {
    .container { max-width: 1280px; }
}

/* Mobile Menu Button Visibility */
.mobile-menu-btn {
    display: none; /* Hidden by default */
}

/* Show mobile menu button ONLY on mobile */
@media (max-width: 767px) {
    .mobile-menu-btn {
        display: block !important;
        background: #f3f4f6 !important;
        border: 1px solid #d1d5db !important;
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 8px !important;
    }
}

/* Hide mobile menu button on desktop */
@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none !important;
    }
}

/* Mobile Menu Styles */
.mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 999;
}

/* Hide mobile menu on desktop */
@media (min-width: 768px) {
    .mobile-menu,
    #mobile-menu {
        display: none !important;
    }
}

/* User Menu Positioning */
#user-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    z-index: 50;
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Responsive text sizes */
@media (max-width: 640px) {
    .text-responsive-lg { font-size: 1.125rem; }
    .text-responsive-xl { font-size: 1.25rem; }
    .text-responsive-2xl { font-size: 1.5rem; }
    .text-responsive-3xl { font-size: 1.875rem; }
}

@media (min-width: 641px) {
    .text-responsive-lg { font-size: 1.25rem; }
    .text-responsive-xl { font-size: 1.5rem; }
    .text-responsive-2xl { font-size: 1.875rem; }
    .text-responsive-3xl { font-size: 2.25rem; }
}

/* Touch targets for mobile */
@media (max-width: 767px) {
    button, 
    .btn,
    a[role="button"] {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }
    
    /* Larger tap targets for navigation */
    nav a,
    .mobile-menu a {
        min-height: 48px;
        padding: 12px 16px;
        display: flex;
        align-items: center;
    }
}

/* Table responsiveness */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive table {
        min-width: 600px;
    }
}

/* Form responsiveness */
@media (max-width: 640px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group > button,
    .btn-group > .btn {
        width: 100%;
    }
}

/* Card responsiveness */
@media (max-width: 640px) {
    .card {
        margin: 0.5rem;
        border-radius: 0.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Grid responsiveness */
@media (max-width: 640px) {
    .grid-responsive {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .grid-responsive {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .grid-responsive {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* Typography responsiveness */
@media (max-width: 640px) {
    h1 { font-size: 1.875rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
}

/* Spacing utilities for mobile */
@media (max-width: 640px) {
    .px-responsive { padding-left: 1rem; padding-right: 1rem; }
    .py-responsive { padding-top: 1rem; padding-bottom: 1rem; }
    .mx-responsive { margin-left: 1rem; margin-right: 1rem; }
    .my-responsive { margin-top: 1rem; margin-bottom: 1rem; }
}

/* Hide elements on specific screen sizes */
.hide-mobile {
    display: block;
}

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

.hide-desktop {
    display: none;
}

@media (max-width: 767px) {
    .hide-desktop {
        display: block !important;
    }
}

/* Accessibility improvements */
@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;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-primary-500 { background-color: #1d4ed8; }
    .text-gray-600 { color: #000000; }
    .border-gray-200 { border-color: #000000; }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .dark-mode-auto {
        background-color: #1f2937;
        color: #f9fafb;
    }
    
    .dark-mode-auto .bg-white {
        background-color: #374151;
    }
    
    .dark-mode-auto .text-gray-900 {
        color: #f9fafb;
    }
    
    .dark-mode-auto .border-gray-200 {
        border-color: #4b5563;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-full-width {
        width: 100% !important;
    }
    
    /* Hide navigation and interactive elements */
    nav,
    .mobile-menu,
    #user-dropdown,
    button:not(.print-show) {
        display: none !important;
    }
}

/* Loading states and skeleton screens */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Focus styles for accessibility */
:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Skip to content link for accessibility */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #3b82f6;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-to-content:focus {
    top: 6px;
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

/* Responsive videos */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}