/* Maiopcao responsive layer - 2026
   Loaded after the legacy styles so the existing PHP/HTML logic is preserved. */

:root {
    --maiopcao-blue: #006aba;
    --maiopcao-blue-dark: #00528f;
    --maiopcao-text: #1f2937;
    --maiopcao-muted: #667085;
    --maiopcao-bg: #f7f9fc;
    --maiopcao-radius: 16px;
    --maiopcao-shadow: 0 10px 30px rgba(16, 24, 40, .08);
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    min-width: 320px;
    overflow-x: hidden;
    color: var(--maiopcao-text);
    background: #fff;
}

*, *::before, *::after { box-sizing: border-box; }

img, svg, video, iframe, canvas {
    max-width: 100%;
}

img { height: auto; }

iframe, video { width: 100%; }

a { overflow-wrap: anywhere; }

.container,
.container-fluid {
    width: 100%;
}

.container {
    padding-left: 18px;
    padding-right: 18px;
}

.row {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
}

.card,
.modal-content,
.dropdown-menu,
.form-control,
.form-select,
.btn {
    border-radius: 10px;
}

.card {
    overflow: hidden;
    border: 1px solid rgba(16, 24, 40, .08);
    box-shadow: 0 4px 18px rgba(16, 24, 40, .05);
}

.btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}

.btn-primary {
    background-color: var(--maiopcao-blue);
    border-color: var(--maiopcao-blue);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--maiopcao-blue-dark);
    border-color: var(--maiopcao-blue-dark);
}

.form-control,
.form-select,
.select2-container .select2-selection--single {
    min-height: 44px;
}

textarea.form-control { min-height: 120px; }

input, select, textarea, button { max-width: 100%; }

.table-responsive,
.table-responsive-sm,
.table-responsive-md,
.table-responsive-lg,
.table-responsive-xl {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table { max-width: 100%; }

/* Header / navigation */
.navbar {
    width: 100%;
}

.navbar-brand img {
    max-width: min(220px, 55vw);
    height: auto;
}

.navbar-toggler {
    min-width: 44px;
    min-height: 44px;
}

.navbar .dropdown-menu {
    max-width: min(92vw, 420px);
}

/* Search */
.search-box {
    width: min(650px, calc(100vw - 32px));
    max-width: 100%;
}

.search-text {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
}

/* Carousels / media */
.carousel,
.carousel-inner,
.carousel-item {
    max-width: 100%;
}

.carousel-item img {
    width: 100%;
    object-fit: cover;
}

.carousel-control-prev,
.carousel-control-next {
    max-width: 72px;
}

/* Modals should never exceed the viewport */
.modal-dialog {
    width: auto;
    max-width: min(900px, calc(100vw - 28px));
    margin-left: auto;
    margin-right: auto;
}

.modal-body {
    overflow-wrap: anywhere;
}

/* Common legacy fixed-width elements */
[style*="width: 1000px"],
[style*="width:1000px"],
[style*="width: 900px"],
[style*="width:900px"],
[style*="width: 800px"],
[style*="width:800px"],
[style*="width: 700px"],
[style*="width:700px"],
[style*="width: 650px"],
[style*="width:650px"],
[style*="width: 600px"],
[style*="width:600px"] {
    max-width: 100% !important;
}

/* More stable focus states */
:focus-visible {
    outline: 3px solid rgba(0, 106, 186, .28);
    outline-offset: 2px;
}

@media (max-width: 991.98px) {
    .navbar .navbar-nav {
        padding: 8px 0 14px;
    }

    .navbar .navbar-nav .nav-link {
        font-size: 16px;
        padding: 10px 8px;
    }

    .navbar-collapse {
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .navbar .nav-item .dropdown-menu {
        position: static !important;
        transform: none !important;
        visibility: visible;
        opacity: 1;
        box-shadow: none;
        border: 0;
        padding-left: .75rem;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 52px;
        height: 50px;
    }
}

@media (max-width: 767.98px) {
    .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    h1, .h1 { font-size: clamp(1.75rem, 8vw, 2.35rem); }
    h2, .h2 { font-size: clamp(1.45rem, 7vw, 2rem); }
    h3, .h3 { font-size: clamp(1.2rem, 6vw, 1.6rem); }

    .row {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }

    .topbar {
        display: none !important;
    }

    .search-box {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 12px auto;
        min-height: 54px;
        height: auto;
        padding: 7px 8px 7px 14px;
    }

    .search-btn {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    .search-text {
        font-size: 16px; /* avoids iOS zoom */
        padding-left: 0;
    }

    .carousel-caption {
        padding-left: 48px;
        padding-right: 48px;
    }

    .carousel-caption p {
        margin-bottom: 16px;
    }

    .back-to-top {
        width: 44px;
        height: 44px;
        right: 14px;
        bottom: 14px;
    }

    .modal-dialog {
        max-width: calc(100vw - 16px);
        margin: 8px auto;
    }

    .modal-content {
        max-height: calc(100vh - 16px);
        overflow-y: auto;
    }

    .btn:not(.navbar-toggler):not(.carousel-control-prev):not(.carousel-control-next) {
        white-space: normal;
    }
}

@media (max-width: 575.98px) {
    body { font-size: 15px; }

    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    .navbar-brand img {
        max-width: 172px;
    }

    .navbar .dropdown-menu {
        width: 100%;
        max-width: 100%;
    }

    .search-box {
        width: calc(100vw - 24px);
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
        height: 44px;
    }

    .carousel-caption {
        padding-left: 38px;
        padding-right: 38px;
    }

    .carousel-caption .btn,
    .carousel-content .btn {
        min-height: 40px;
        padding: .5rem .8rem;
        font-size: .9rem;
    }

    .card-body { padding: 14px; }

    .form-control,
    .form-select,
    .select2-container,
    .select2-container .select2-selection--single {
        width: 100% !important;
    }

    .d-flex {
        min-width: 0;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .pagination .page-link {
        padding: .45rem .65rem;
    }
}

@media (max-width: 380px) {
    .container,
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    .navbar-brand img { max-width: 155px; }

    .search-box {
        width: calc(100vw - 20px);
        min-height: 50px;
        padding-left: 12px;
    }

    .search-btn {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .btn { font-size: .9rem; }
}
