/* ============================================================================
   MOBILE-FIRST RESPONSIVE DESIGN FIXES
   Complete CSS override and enhancement for all responsive issues
   ============================================================================ */

:root {
    --main-color: #2196f3;
    --text-dark: #41464b;
    --text-light: #64707b;
    --bg-light: #f0f0f0;
    --transition-speed: 0.3s ease-in-out;
}

/* ============================================================================
   1. RESPONSIVE TYPOGRAPHY - Mobile First
   ============================================================================ */

html {
    scroll-behavior: smooth;
}

/* Extra small devices (< 420px) */
@media (max-width: 419px) {
    html {
        font-size: 12px;
    }

    body {
        font-size: 0.9rem;
    }

    h1 { font-size: 1.4rem; line-height: 1.2; }
    h2 { font-size: 1.2rem; line-height: 1.3; }
    h3 { font-size: 1rem; line-height: 1.4; }
    h4 { font-size: 0.9rem; line-height: 1.4; }
    h5 { font-size: 0.8rem; line-height: 1.5; }
    h6 { font-size: 0.75rem; line-height: 1.5; }

    p, .card-text, label {
        font-size: 11px;
        line-height: 1.5;
    }
}

/* Small devices (420px - 576px) */
@media (min-width: 420px) and (max-width: 576px) {
    html {
        font-size: 13px;
    }

    body {
        font-size: 0.95rem;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
    h5 { font-size: 0.9rem; }

    p, .card-text, label {
        font-size: 12px;
    }
}

/* Medium devices (576px - 768px) */
@media (min-width: 577px) and (max-width: 768px) {
    html {
        font-size: 14px;
    }

    p, .card-text {
        font-size: 13px;
    }
}

/* Tablets (768px - 992px) */
@media (min-width: 769px) and (max-width: 991px) {
    html {
        font-size: 14px;
    }

    p {
        font-size: 14px;
    }
}

/* Desktop and above (992px+) */
@media (min-width: 992px) {
    html {
        font-size: 16px;
    }

    p {
        font-size: 15px;
    }
}

/* ============================================================================
   2. CONTAINER & PADDING - Mobile First
   ============================================================================ */

.container,
.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (max-width: 420px) {
    .container,
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* ============================================================================
   3. NAVBAR & NAVIGATION - Mobile First
   ============================================================================ */

/* Main navigation - Stack on mobile */
.navbar-nav {
    width: 100%;
    flex-direction: column;
}

@media (min-width: 992px) {
    .navbar-nav {
        flex-direction: row;
        float: right;
    }
}

/* Navbar items responsive sizing */
.navbar-nav > li {
    height: auto;
    line-height: normal;
    border-bottom: 1px solid #e0e0e0;
}

@media (min-width: 992px) {
    .navbar-nav > li {
        height: 65px;
        line-height: 65px;
        border-bottom: 3px solid rgba(0, 0, 0, 0);
    }
}

/* Navigation links - Responsive font size */
.navbar-nav > li > a {
    font-size: 12px;
    padding: 8px 5px;
    display: block;
}

@media (min-width: 576px) {
    .navbar-nav > li > a {
        font-size: 13px;
    }
}

@media (min-width: 768px) {
    .navbar-nav > li > a {
        font-size: 14px;
        padding: 0 10px;
    }
}

@media (min-width: 992px) {
    .navbar-nav > li > a {
        font-size: 14.5px;
        margin: 0 10px;
    }
}

/* ============================================================================
   4. DROPDOWN MENUS - Mobile First
   ============================================================================ */

.dropdown-menu {
    position: static;
    width: 100% !important;
    float: none;
    box-shadow: none;
    border-radius: 0;
}

@media (min-width: 992px) {
    .dropdown-menu {
        position: absolute;
        width: auto !important;
        float: left;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        border-radius: 0.25rem;
    }
}

/* Mega menu responsive */
.dropdown-cust.mega-menu {
    width: 100% !important;
    min-width: auto !important;
    border: 1px solid #e0e0e0 !important;
    flex-direction: column;
}

@media (min-width: 992px) {
    .dropdown-cust.mega-menu {
        width: auto !important;
        min-width: 450px !important;
        border: 2px solid var(--main-color) !important;
    }

    .dropdown-cust.mega-menu .row {
        flex-direction: row;
    }

    .dropdown-cust.mega-menu .col-md-5,
    .dropdown-cust.mega-menu .col-md-7 {
        flex: 0 0 auto;
    }
}

/* ============================================================================
   5. MODAL DIALOGS - Mobile First
   ============================================================================ */

.modal-dialog {
    width: 95%;
    margin: auto;
    margin-top: 20px;
}

@media (min-width: 420px) {
    .modal-dialog {
        width: 90%;
        margin-top: 50px;
    }
}

@media (min-width: 576px) {
    .modal-dialog {
        width: 500px;
        margin: 50px auto;
    }
}

.modal-body {
    padding: 10px;
    font-size: 12px;
}

@media (min-width: 420px) {
    .modal-body {
        padding: 15px;
        font-size: 13px;
    }
}

@media (min-width: 576px) {
    .modal-body {
        padding: 25px 45px;
        font-size: 14px;
    }
}

/* ============================================================================
   6. FORMS & INPUTS - Mobile First
   ============================================================================ */

.form-control {
    font-size: 13px;
    padding: 0.35rem 0.5rem;
}

@media (max-width: 420px) {
    .form-control {
        font-size: 16px; /* iOS zoom fix */
    }
}

@media (min-width: 576px) {
    .form-control {
        font-size: 14px;
        padding: 0.5rem 0.75rem;
    }
}

/* ============================================================================
   7. CARDS & COMPONENTS - Mobile First
   ============================================================================ */

.card {
    margin-bottom: 10px;
}

@media (min-width: 576px) {
    .card {
        margin-bottom: 15px;
    }
}

.card-body {
    padding: 0.75rem;
}

@media (min-width: 576px) {
    .card-body {
        padding: 1.25rem;
    }
}

/* ============================================================================
   8. GRID COLUMNS - Mobile First (Full Width)
   ============================================================================ */

.col-md-3,
.col-md-4,
.col-md-5,
.col-md-6,
.col-md-7,
.col-lg-4,
.col-lg-6,
.col-lg-8 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-bottom: 15px;
}

@media (min-width: 768px) {
    .col-md-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-md-4 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-md-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

@media (min-width: 992px) {
    .col-md-3 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }

    .col-md-4 {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }

    .col-md-5 {
        flex: 0 0 41.667% !important;
        max-width: 41.667% !important;
    }

    .col-md-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-md-7 {
        flex: 0 0 58.333% !important;
        max-width: 58.333% !important;
    }

    .col-lg-4 {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }

    .col-lg-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-lg-8 {
        flex: 0 0 66.667% !important;
        max-width: 66.667% !important;
    }
}

/* ============================================================================
   9. BUTTONS - Mobile First
   ============================================================================ */

.btn {
    font-size: 12px;
    padding: 6px 10px;
}

@media (min-width: 576px) {
    .btn {
        font-size: 13px;
        padding: 8px 12px;
    }
}

@media (min-width: 992px) {
    .btn {
        font-size: 14px;
        padding: 10px 15px;
    }
}

.btn-lg {
    font-size: 13px;
    padding: 8px 12px;
}

@media (min-width: 576px) {
    .btn-lg {
        font-size: 14px;
        padding: 10px 15px;
    }
}

/* ============================================================================
   10. IMAGES & MEDIA - Responsive
   ============================================================================ */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

picture,
figure {
    max-width: 100%;
}

/* ============================================================================
   11. TABLES - Mobile Friendly
   ============================================================================ */

@media (max-width: 767px) {
    table {
        font-size: 11px;
        margin-bottom: 1.5rem;
    }

    table thead {
        display: none;
    }

    table tbody,
    table tr,
    table td {
        display: block;
        width: 100%;
    }

    table tr {
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        padding: 0.5rem;
    }

    table td {
        padding: 0.5rem 0;
        text-align: left;
        position: relative;
    }

    table td::before {
        content: attr(data-label);
        font-weight: bold;
        display: block;
    }
}

/* ============================================================================
   12. SPACING UTILITIES - Mobile First
   ============================================================================ */

section {
    padding: 0.8rem 0;
}

@media (min-width: 576px) {
    section {
        padding: 1.5rem 0;
    }
}

@media (min-width: 992px) {
    section {
        padding: 3rem 0;
    }
}

/* ============================================================================
   13. VISIBILITY & DISPLAY - Mobile First
   ============================================================================ */

.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-inline {
    display: inline !important;
}

.d-flex {
    display: flex !important;
}

/* ============================================================================
   14. SEARCH BAR - Mobile Responsive
   ============================================================================ */

.navbar .search-open {
    position: relative;
    width: 100%;
    height: auto;
    top: auto;
    right: auto;
    display: none;
    margin-top: 5px;
    padding: 5px;
    background: transparent;
    box-shadow: none;
}

@media (min-width: 992px) {
    .navbar .search-open {
        position: absolute;
        width: auto;
        height: 50px;
        top: 65px;
        right: 0;
        margin-top: 0;
        padding: 4px;
        background: #fff;
        box-shadow: 0 0 3px #ddd;
    }
}

/* ============================================================================
   15. FOOTER - Mobile Responsive
   ============================================================================ */

footer {
    padding: 40px 0;
}

@media (min-width: 768px) {
    footer {
        padding: 70px 0;
    }
}

footer h2 {
    font-size: 16px;
    margin-top: 20px;
}

@media (min-width: 768px) {
    footer h2 {
        font-size: 18px;
        margin-top: 50px;
    }
}

footer p {
    font-size: 12px;
}

@media (min-width: 576px) {
    footer p {
        font-size: 13px;
    }
}

@media (min-width: 992px) {
    footer p {
        font-size: 15px;
    }
}

/* ============================================================================
   16. UTILITIES - General Responsive Fixes
   ============================================================================ */

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

/* Touch-friendly tap targets */
@media (max-width: 767px) {
    a, button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================================================
   END OF MOBILE-FIRST RESPONSIVE FIXES
   ============================================================================ */
