/* Mobile-First Responsive Enhancements */

/* Small Phones (max 576px) */
@media (max-width: 576px) {
    /* Prevent text scaling on mobile */
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    /* Navigation - Fixed improvements */
    .navbar,
    .enhanced-navbar {
        height: 60px !important;
        padding: 8px 0 !important;
        background: rgba(0, 0, 0, 0.95) !important;
    }
    
    .navbar-brand {
        gap: 8px;
    }
    
    .brand-text {
        font-size: 0.9rem;
    }
    
    .navbar-brand img {
        height: 35px !important;
        width: auto;
    }
    
    .navbar-nav {
        padding: 1rem 0;
        background: rgba(0, 0, 0, 0.95);
        border-radius: 8px;
        margin-top: 0.5rem;
    }
    
    .nav-link {
        padding: 0.75rem 1rem !important;
        font-size: 0.95rem;
        position: relative;
        z-index: 1000;
    }
    
    .nav-link span {
        margin-left: 0.5rem;
    }
    
    .dropdown-menu {
        min-width: 200px;
        right: 0 !important;
        left: auto !important;
        background: rgba(0, 0, 0, 0.98) !important;
        position: static !important;
        float: none;
        width: 100% !important;
        margin: 0 !important;
        padding: 0.5rem 0 !important;
        border: none !important;
        box-shadow: none !important;
        z-index: 1001;
    }
    
    .dropdown-item {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
        color: var(--text-primary) !important;
        position: relative;
        z-index: 1001;
        pointer-events: auto !important;
    }
    
    .dropdown-item:hover {
        background: rgba(99, 102, 241, 0.2) !important;
        color: var(--brand-primary) !important;
    }
    
    /* Hero section */
    .hero-section,
    .page-header {
        padding: 80px 1rem 50px !important;
        margin-top: 60px;
    }
    
    .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.3;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem !important;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.6rem 1.2rem !important;
        font-size: 0.9rem !important;
        margin: 0.5rem 0.5rem 0.5rem 0 !important;
    }
    
    .btn-lg {
        padding: 0.7rem 1.5rem !important;
        font-size: 0.95rem !important;
    }
    
    /* Container padding */
    .container {
        padding: 0 1rem !important;
    }
    
    /* Cards */
    .card,
    .service-card,
    .feature-card {
        margin-bottom: 1.5rem;
        padding: 1.25rem !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .card-title {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .card-text {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Sections */
    .section {
        padding: 2rem 1rem !important;
    }
    
    .section h2 {
        font-size: 1.5rem !important;
        margin-bottom: 1.5rem;
    }
    
    .section h3 {
        font-size: 1.2rem !important;
        margin-bottom: 1rem;
    }
    
    .section p {
        font-size: 0.95rem !important;
        line-height: 1.6;
    }
    
    /* Grid items */
    .row > [class*='col-'] {
        margin-bottom: 1rem;
    }
    
    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Gallery */
    .gallery-item {
        margin-bottom: 1rem;
    }
    
    .gallery-item img {
        height: 200px !important;
        object-fit: cover;
    }
    
    /* Forms */
    form {
        margin: 1.5rem 0;
    }
    
    .form-group,
    .mb-3 {
        margin-bottom: 1rem !important;
    }
    
    .form-control,
    .form-select,
    textarea {
        padding: 0.75rem !important;
        font-size: 1rem !important; /* Prevents zoom on iOS */
        border-radius: 8px !important;
    }
    
    label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        font-weight: 500;
    }
    
    /* Lists */
    ul, ol {
        margin-left: 1.5rem;
        margin-bottom: 1rem;
    }
    
    li {
        margin-bottom: 0.5rem;
        font-size: 0.95rem;
    }
    
    /* Tables */
    .table {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }
    
    .table thead th {
        padding: 0.75rem 0.5rem !important;
    }
    
    .table td {
        padding: 0.6rem 0.5rem !important;
    }
    
    /* Footer */
    footer {
        padding: 40px 1rem 20px !important;
    }
    
    footer h5 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    footer p {
        font-size: 0.85rem;
    }
    
    .footer-link {
        font-size: 0.85rem;
        line-height: 1.8;
    }
    
    /* Modals */
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-body {
        padding: 1.25rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    /* Alerts */
    .alert {
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
        font-size: 0.9rem;
    }
    
    /* Dropdowns */
    .dropdown-menu {
        font-size: 0.9rem;
    }
    
    /* Badges */
    .badge {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }
    
    /* Flex spacing */
    .gap-2 {
        gap: 0.5rem !important;
    }
    
    .gap-3 {
        gap: 0.75rem !important;
    }
    
    /* Text utilities */
    .text-center {
        text-align: center;
    }
    
    /* Margin utilities */
    .mt-1, .mt-2, .mt-3 {
        margin-top: 0.5rem !important;
    }
    
    .mb-1, .mb-2, .mb-3 {
        margin-bottom: 0.5rem !important;
    }
    
    .ms-1, .ms-2 {
        margin-left: 0.5rem !important;
    }
    
    /* Touch-friendly targets */
    a, button, .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Navbar toggler */
    .navbar-toggler {
        width: 36px !important;
        height: 36px !important;
        padding: 4px !important;
        position: relative;
        z-index: 1002;
    }
    
    .navbar-collapse {
        background: rgba(0, 0, 0, 0.95);
        border-radius: 8px;
        margin-top: 0.5rem;
        position: relative;
        z-index: 1001;
    }
    
    /* Remove hover effects on touch devices */
    @media (hover: none) {
        .card:hover,
        .service-card:hover {
            transform: none !important;
        }
        
        a:active {
            opacity: 0.8;
        }
    }
    
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* Improve readability */
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    /* Enhance button touch experience */
    .btn:active {
        transform: scale(0.98);
    }
}

/* Extra small phones (max 400px) */
@media (max-width: 400px) {
    .hero-title {
        font-size: 1.4rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.85rem !important;
    }
    
    .section h2 {
        font-size: 1.25rem !important;
    }
    
    .section h3 {
        font-size: 1rem !important;
    }
    
    .service-card {
        padding: 1rem !important;
    }
    
    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.85rem !important;
    }
    
    footer {
        padding: 30px 1rem 15px !important;
    }
    
    .dropdown-menu {
        min-width: 160px;
    }
}

/* Small tablets (577px - 768px) */
@media (min-width: 577px) and (max-width: 768px) {
    .navbar,
    .enhanced-navbar {
        height: 70px !important;
    }
    
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
    }
    
    .section {
        padding: 2.5rem 1.5rem !important;
    }
    
    .section h2 {
        font-size: 1.75rem !important;
    }
    
    .card {
        padding: 1.5rem !important;
    }
    
    .btn {
        padding: 0.65rem 1.3rem !important;
        font-size: 0.95rem !important;
    }
}

/* Orientation handling */
@media (max-height: 600px) and (orientation: landscape) {
    .navbar,
    .enhanced-navbar {
        height: 50px !important;
    }
    
    .brand-text {
        display: none;
    }
    
    .hero-section,
    .page-header {
        padding: 60px 1rem 30px !important;
    }
}

/* High DPI devices (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Improve dropdown on touch devices */
@media (hover: none) and (pointer: coarse) {
    .dropdown-menu {
        position: fixed;
        top: auto !important;
        left: auto !important;
        right: 0 !important;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .nav-item.dropdown:hover .dropdown-menu {
        display: none;
    }
}
