/* =========================================
   RESET GERAL
========================================= */

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

html,
body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
}

body {
    min-width: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f7f6;
    color: #333;
    line-height: 1.4;
}

/* =========================================
   CONTAINER PRINCIPAL
========================================= */
.container {
    width: calc(100% - 30px);
    max-width: 900px;
    margin: 15px auto;
    padding: 25px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}


/* =========================================
   TÍTULOS E LINKS
========================================= */

h1,
h2 {
    color: #1a2b3c;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    overflow-wrap: anywhere;
}

h1 {
    margin-top: 0;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.2;
}

h2 {
    font-size: clamp(21px, 3vw, 30px);
}

h3 {
    overflow-wrap: anywhere;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* =========================================
   CABEÇALHO E LOGO
========================================= */

.site-header {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 0 8px;
    text-align: center;
}

.site-logo-link {
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}

.site-logo {
    display: block;
    width: 100px;
    max-width: 100%;
    max-height: 80px;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}


/* =========================================
   NAVEGAÇÃO
========================================= */

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
}

nav h1 {
    flex: 1 1 250px;
    min-width: 0;
    margin: 0;
}

nav a {
    white-space: normal;
    overflow-wrap: anywhere;
    font-weight: 500;
}


/* =========================================
   FORMULÁRIOS
========================================= */

form {
    width: 100%;
    max-width: 100%;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 7px;
    background: #fff;
    color: #333;
    font-size: 16px;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.12);
}


/* =========================================
   CAMPOS DO CLIENTE
========================================= */

.form-group {
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
    padding: 22px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
}

.form-group label {
    margin-bottom: 7px;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    gap: 20px;
}

.form-inline > div {
    flex: 1 1 280px;
    min-width: 0;
}


/* Compatibilidade com outras estruturas de campos */

.form-row,
.form-group-row,
.fields-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    max-width: 100%;
}

.form-row > *,
.form-group-row > *,
.fields-row > * {
    flex: 1 1 280px;
    min-width: 0;
}


/* =========================================
   BOTÕES
========================================= */

button,
.btn-request {
    display: inline-block;
    max-width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 7px;
    background: #007bff;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease;
}

button:hover,
.btn-request:hover {
    background: #0056b3;
}

button:disabled,
.btn-request:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.btn-request {
    padding: 8px 12px;
    font-size: 14px;
}

.btn-secondary {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 12px 20px;
    border: 1px solid #ccc;
    border-radius: 7px;
    background: #f4f7f6;
    color: #333;
    text-align: center;
    text-decoration: none;
}

.btn-secondary:hover {
    background: #e9e9e9;
}

.btn-delete {
    padding: 6px 10px;
    border: none;
    border-radius: 5px;
    background: #d9534f;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.btn-delete:hover {
    background: #c9302c;
}


/* =========================================
   FORMULÁRIO DE LOGIN
========================================= */

.login-form {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 30px auto;
}

.login-form div {
    margin-bottom: 15px;
}

.login-form button {
    width: 100%;
}


/* =========================================
   FORMULÁRIO DE BUSCA
========================================= */

#search-form,
.search-box,
.search-container {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    gap: 10px;
    margin: 10px 0 20px;
}

#search-form input,
.search-box input,
.search-container input {
    flex: 1 1 250px;
    min-width: 0;
}

#search-form button,
.search-box button,
.search-container button {
    flex: 0 0 auto;
}


/* =========================================
   MENSAGENS
========================================= */

.error {
    color: #d9534f;
}

.success {
    color: #5cb85c;
}

#message-container {
    width: 100%;
    max-width: 100%;
    margin: 15px 0;
    text-align: center;
    font-size: 1.1em;
    font-weight: 600;
    overflow-wrap: anywhere;
}


/* =========================================
   RESULTADOS DA BUSCA
========================================= */

#results-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    gap: 15px;
}

.result-card {
    display: flex;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 15px;
    padding: 15px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.result-card img {
    width: 100px;
    height: 150px;
    max-width: 100px;
    flex: 0 0 100px;
    object-fit: cover;
    border-radius: 5px;
}

.result-card .card-content {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.result-card h3 {
    margin: 0 0 10px;
}

.result-card p {
    margin: 0 0 15px;
    color: #555;
    font-size: 0.9em;
}


/* =========================================
   PÁGINA INICIAL
========================================= */

.welcome-container {
    width: 100%;
    max-width: 100%;
    padding: 10px 0 20px;
    text-align: center;
}

.welcome-container h1,
.welcome-container p {
    text-align: center;
}

.welcome-container h1 {
    margin: 5px 0 15px;
}

.welcome-container p {
    margin: 0 0 25px;
}

.welcome-links {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 500px;
    gap: 12px;
    margin: 0 auto;
}

.welcome-links a {
    display: block;
    width: 100%;
    padding: 13px 15px;
    background: #007bff;
    color: #fff;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
}

.welcome-links a:hover {
    background: #0056b3;
}


/* =========================================
   TABELAS ADMINISTRATIVAS
========================================= */

.requests-table {
    width: 100%;
    max-width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
    table-layout: auto;
}

.requests-table th,
.requests-table td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.requests-table th {
    background: #f2f2f2;
}

.requests-table tr:nth-child(even) {
    background: #f9f9f9;
}

.requests-table td form {
    margin: 0;
}

.requests-table .message-row td {
    padding: 10px 15px;
    background: #fdfdfd;
    border-bottom: 2px solid #ddd;
    color: #333;
    font-size: 0.95em;
    line-height: 1.5;
}

.requests-table .message-row strong {
    margin-right: 5px;
    color: #0056b3;
}


/* =========================================
   RODAPÉ
========================================= */

.site-footer {
    display: block;
    width: auto;
    max-width: none;
    min-width: 0;
    margin: 30px 0 0;
    padding: 20px 10px 15px;
    box-sizing: border-box;
    text-align: center;
    clear: both;
    overflow: hidden;
}

.site-footer .admin-link {
    display: block;
    width: 100%;
    margin: 0 0 12px;
    padding: 0;
    color: #aaa;
    font-size: 10px;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    opacity: 0.45;
}

.site-footer .admin-link:hover {
    color: #666;
    opacity: 1;
    text-decoration: underline;
}

.site-footer .copyright {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    color: #888;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}


/* =========================================
   TABLETS
========================================= */

@media (max-width: 900px) {
    .container {
        width: calc(100% - 24px);
        padding: 20px;
    }
}


/* =========================================
   CELULARES
========================================= */

@media (max-width: 600px) {

    .container {
        width: calc(100% - 16px);
        margin: 8px auto;
        padding: 14px;
        border-radius: 8px;
    }

    h1 {
        font-size: 26px;
        line-height: 1.2;
        text-align: center;
    }

    h2 {
        font-size: 22px;
    }

    nav {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        text-align: center;
    }

    nav h1 {
        width: 100%;
        text-align: center;
    }

    nav a {
        white-space: normal;
        text-align: center;
    }

    .site-logo {
        width: 80px;
        max-height: 70px;
    }

    .form-group {
        padding: 14px;
        margin-bottom: 15px;
    }

    .form-inline,
    .form-row,
    .form-group-row,
    .fields-row {
        flex-direction: column;
        gap: 12px;
    }

    .form-inline > div,
    .form-row > *,
    .form-group-row > *,
    .fields-row > * {
        width: 100%;
        flex: 1 1 auto;
    }

    #search-form,
    .search-box,
    .search-container {
        flex-direction: column;
    }

    #search-form input,
    #search-form button,
    .search-box input,
    .search-box button,
    .search-container input,
    .search-container button {
        width: 100%;
        flex: 1 1 auto;
    }

    button,
    .btn-request {
        max-width: 100%;
    }

    .result-card {
        gap: 10px;
        padding: 10px;
    }

    .result-card img {
        width: 80px;
        height: 120px;
        max-width: 80px;
        flex-basis: 80px;
    }

    .result-card h3 {
        font-size: 17px;
    }

    .result-card p {
        font-size: 14px;
    }

    .requests-table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        font-size: 13px;
    }

    .requests-table th,
    .requests-table td {
        padding: 8px;
    }

    .site-footer {
        padding: 20px 8px 12px;
    }

    .site-footer .copyright {
        font-size: 11px;
    }
}

/* =========================================
   PROTEÇÃO CONTRA ESTOURO HORIZONTAL
========================================= */

.site-header,
.site-footer,
.welcome-container,
.welcome-links,
form,
#search-form,
#results-container,
.result-card,
.card-content {
    min-width: 0;
    max-width: 100%;
}

.result-card .card-content {
    overflow-wrap: anywhere;
    word-break: break-word;
}

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

/* CORREÇÃO DEFINITIVA DO RODAPÉ */
html,
body {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden !important;
}

.site-footer {
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    box-sizing: border-box !important;
}

.site-footer * {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.site-footer {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    overflow: hidden !important;
}

/* SELECT PERSONALIZADO - TIPO */
select#tipo,
select.campo-selecao,
.campo-selecao {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 54px !important;
    padding: 0 48px 0 16px !important;
    border: 1px solid #cfd6dd !important;
    border-radius: 10px !important;
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 20px !important;
    color: #333333 !important;
    font-family: inherit !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    box-sizing: border-box !important;
    transition: border-color .2s ease, box-shadow .2s ease !important;
}

select#tipo:hover,
select.campo-selecao:hover,
.campo-selecao:hover {
    border-color: #007bff !important;
}

select#tipo:focus,
select.campo-selecao:focus,
.campo-selecao:focus {
    outline: none !important;
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, .15) !important;
}

select#tipo option,
select.campo-selecao option,
.campo-selecao option {
    background: #ffffff;
    color: #333333;
}
