/* ==========================================
   RESPONSIVE ENHANCEMENTS - COMPLETE
   Mobile-First Design System
   ========================================== */

/* Base responsive utilities (existing code) */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================
   MOBILE NAVIGATION ENHANCEMENT
   ========================================== */
.mobile-nav-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Better mobile menu animations */
@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.nav-links.active {
    animation: slideInFromLeft 0.3s ease-out;
}

/* ==========================================
   RESPONSIVE TABLES - ENHANCED
   ========================================== */
@media (max-width: 768px) {
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.5rem 0.25rem !important;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Responsive forms */
@media (max-width: 640px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    input, select, textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem !important;
        width: 100% !important;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-col {
        width: 100% !important;
    }
}

/* Responsive cards */
@media (max-width: 640px) {
    .card {
        margin-bottom: 1rem;
        padding: 1rem !important;
    }
}

/* Responsive buttons */
@media (max-width: 640px) {
    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem !important;
    }
}

/* Responsive navbar */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 0.75rem !important;
    }
    
    .navbar-brand {
        font-size: 1.125rem !important;
    }
}

/* Responsive grid adjustments */
@media (max-width: 640px) {
    [class*="grid-cols-"] {
        grid-template-columns: 1fr !important;
    }
    
    [class*="md:grid-cols-"] {
        grid-template-columns: 1fr !important;
    }
    
    [class*="gap-"] {
        gap: 0.5rem !important;
    }
}

/* Hide/Show utilities */
@media (max-width: 640px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .hide-tablet {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Prevent horizontal scroll */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Better touch targets on mobile */
@media (max-width: 640px) {
    button, a, input[type="checkbox"], input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Responsive typography */
@media (max-width: 640px) {
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    h4, h5, h6 {
        font-size: 1rem !important;
    }
    
    p {
        font-size: 0.95rem !important;
    }
}

/* Responsive spacing */
@media (max-width: 640px) {
    [class*="px-"] {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    [class*="py-"] {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* Flexbox utilities for mobile */
@media (max-width: 640px) {
    .flex-col-mobile {
        flex-direction: column !important;
    }
    
    .gap-mobile {
        gap: 0.5rem !important;
    }
}

/* Container queries */
.container {
    width: 100%;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
        padding: 0 1rem;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
        padding: 0 2rem;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
        padding: 0 2rem;
    }
}

/* Print styles */
@media print {
    body, html {
        background: white;
    }
    
    .no-print, .navbar, .sidebar, .modal {
        display: none !important;
    }
}

/* ==========================================
   STICKY HEADER & BOTTOM NAVBAR
   ========================================== */

/* Fixed/Sticky Header */
header, .navbar, [role="banner"] {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Adjust body for fixed header and bottom nav on mobile */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
        padding-bottom: 70px;
    }
    
    main, .container, section {
        padding-top: 0;
    }
}

/* Desktop - no bottom nav */
@media (min-width: 769px) {
    body {
        padding-top: 60px;
    }
}

/* Bottom Navigation Bar - Mobile Only */
@media (max-width: 768px) {
    .bottom-nav, [role="navigation"].bottom {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 70px;
        background: white;
        border-top: 1px solid #e5e7eb;
        z-index: 999;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    .bottom-nav a, [role="navigation"].bottom a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #6b7280;
        padding: 0.5rem;
        font-size: 0.75rem;
        transition: all 0.3s ease;
        gap: 0.25rem;
    }
    
    .bottom-nav a:hover, 
    .bottom-nav a.active,
    [role="navigation"].bottom a:hover,
    [role="navigation"].bottom a.active {
        color: #3b82f6;
        background-color: #eff6ff;
    }
    
    .bottom-nav i, [role="navigation"].bottom i {
        font-size: 1.5rem;
    }
    
    .bottom-nav span, [role="navigation"].bottom span {
        display: block;
        font-weight: 500;
    }
}

/* Hide bottom nav on desktop */
@media (min-width: 769px) {
    .bottom-nav, [role="navigation"].bottom {
        display: none !important;
    }
}

/* Mobile app-like styling */
@media (max-width: 640px) {
    header, .navbar, [role="banner"] {
        height: 56px;
        padding: 0.75rem 0.5rem;
    }
    
    header h1, .navbar h1, [role="banner"] h1 {
        font-size: 1rem;
        margin: 0;
    }
    
    header button, .navbar button, [role="banner"] button {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

/* Tablet size */
@media (min-width: 641px) and (max-width: 768px) {
    header, .navbar, [role="banner"] {
        height: 60px;
        padding: 0.75rem 1rem;
    }
}
