/* style.css - Estilos básicos para o projeto */

body {
    font-family: 'Inter', sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    /* Ajusta o padding do body para acomodar o cabeçalho fixo */
    padding-top: 65px;
    /* Altura mais compacta para o header */
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    min-height: 100vh;
    color: #333;
}

/* Novo estilo para o cabeçalho fixo */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    /* Por padrão, empilha itens (para mobile first) */
    align-items: center;
    padding: 5px 10px;
    /* Padding reduzido para cabeçalho menor */
    box-sizing: border-box;
}

/* Linha superior do cabeçalho (logo, título, hambúrguer) */
.header-top-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    /* Espaça logo, título e hambúrguer */
    align-items: center;
    min-height: 50px;
    /* Altura mínima para a linha superior */
}

.header-logo {
    max-width: 50px;
    /* Logo menor para caber no cabeçalho fixo */
    height: auto;
    display: block;
    margin-right: 10px;
    /* Espaço entre logo e título */
    border-radius: 8px;
    object-fit: contain;
}

.header-title {
    font-size: 1.1em;
    /* Título bem menor em mobile */
    margin: 0;
    color: #2c3e50;
    white-space: nowrap;
    /* Evita que o título quebre linha */
    text-overflow: ellipsis;
    /* Adiciona "..." se o título for muito longo */
    overflow: hidden;
    /* Garante que text-overflow funcione */
    flex-grow: 1;
    /* Permite que o título ocupe o espaço central */
    text-align: center;
    /* Centraliza o texto do título */
}

/* Estilos para o ícone do menu hambúrguer */
.menu-toggle {
    display: block;
    /* Exibe o ícone de hambúrguer em mobile */
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    padding: 5px;
    margin-left: 10px;
    /* Espaço entre título e hambúrguer */
    width: 50px;
    /* Largura fixa para o botão do hambúrguer */
    text-align: center;
    /* Centraliza o ícone dentro do botão */
}

/* Estilos da navegação (o menu que aparece/desaparece) */
.main-nav {
    display: flex;
    flex-direction: column;
    /* Botões um abaixo do outro em mobile */
    gap: 8px;
    width: 100%;
    /* Ocupa toda a largura disponível */
    padding-top: 5px;
    /* Espaço entre a barra superior e os itens do menu */
    display: none;
    /* Oculta o menu por padrão em mobile */
}

.main-nav.expanded {
    display: flex;
    /* Exibe o menu quando expandido */
}

.main-nav .button {
    background-color: #495057;
    padding: 8px 15px;
    /* Padding menor para os botões do menu */
    text-decoration: none;
    color: white;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    margin-top: 0;
    font-size: 0.9em;
    width: 100%;
    /* Ocupa a largura total em mobile */
    text-align: center;
    /* Alinha o texto do botão ao centro */
}

.main-nav .button:hover {
    background-color: #343a40;
}

.main-nav .button.active {
    background-color: #007bff;
    font-weight: bold;
}


/* --- Conteúdo principal do container (resto da página) --- */
.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1000px;
    box-sizing: border-box;
    margin-bottom: 20px;
    flex-shrink: 0;
    /* Impede que o container encolha além do necessário */
}

h3,
h4,
h5 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
    border-color: #007bff;
    outline: none;
}

button {
    background-color: #007bff;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
}

button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.button {
    display: inline-block;
    background-color: #6c757d;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 15px;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.button:hover {
    background-color: #5a6268;
}

.button-small {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 6px;
    width: auto;
}

.button-delete {
    background-color: #dc3545;
}

.button-delete:hover {
    background-color: #c82333;
}

.message {
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 8px;
    text-align: center;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}


table {
    width: 100%;
    max-width: 100%;
    /* Garante que a tabela não exceda a largura do pai */
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fdfdfd;
    border-radius: 8px;
    overflow: hidden;
    /* Adicionado para permitir rolagem horizontal em tabelas largas em mobile */
    overflow-x: auto;
    table-layout: fixed;
    /* Força o layout da tabela a respeitar larguras */
}

th,
td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-align: left;
    word-break: break-word;
    /* Permite quebrar palavras longas */
    white-space: normal;
    /* Permite que o texto quebre linha */
}

th {
    background-color: #e9ecef;
    color: #495057;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f1f1;
}

.cotacao-card {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cotacao-card h4 {
    color: #007bff;
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
}

.cotacao-card h5 {
    color: #2c3e50;
    text-align: left;
    margin-top: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cotacao-card h5 span,
.cotacao-card h6 span {
    flex-grow: 1;
}

.cotacao-card h6 {
    color: #555;
    text-align: left;
    margin-top: 20px;
    /* Mais espaço acima */
    margin-bottom: 10px;
    font-size: 1em;
    border-bottom: 1px solid #ddd;
    /* Linha sólida e mais visível abaixo do título */
    padding-bottom: 10px;
    border-top: 2px solid #e0e0e0;
    /* Linha separadora visível acima do título */
    padding-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.search-form,
.filter-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.search-form .form-group,
.filter-form .form-group {
    flex-grow: 1;
    margin-bottom: 0;
    min-width: 180px;
}

.search-form button,
.filter-form button {
    width: auto;
    padding: 12px 20px;
    margin-top: 0;
}


/* Estilos para recolher/expandir */
.collapsible-content {
    display: none;
}

.collapsible-content.expanded {
    display: block;
}

.collapsible-content.collapsed {
    display: none;
}


/* Estilos para o Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
    color: white;
    font-size: 1.2em;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


/* Estilo para o footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    color: #777;
    font-size: 0.9em;
    width: 100%;
    max-width: 1000px;
    /* Alinha com o container */
    flex-shrink: 0;
}

footer a {
    color: #007bff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Estilo para o botão flutuante */
.floating-button {
    background-color: #28a745;
    color: white;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.floating-button:hover {
    background-color: #218838;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}


/* --- Responsividade --- */
@media (max-width: 768px) {
    body {
        padding-top: 100px;
        /* Ajusta padding para header compacto em mobile */
        padding-left: 10px;
        padding-right: 10px;
    }

    .fixed-header {
        flex-direction: column;
        /* Empilha a top-row e a nav */
        align-items: center;
        padding: 5px 10px;
        height: auto;
    }

    .header-top-row {
        flex-direction: row;
        /* Logo, title, toggle na mesma linha */
        justify-content: space-between;
        width: 100%;
        min-height: 40px;
        /* Altura mínima da linha superior */
    }

    .header-logo {
        max-width: 40px;
        /* Logo ainda menor */
        margin-right: 5px;
    }

    .header-title {
        font-size: 1em;
        /* Título menor */
        white-space: normal;
        text-align: left;
        flex-grow: 1;
        margin: 0 5px;
    }

    .menu-toggle {
        display: block;
        margin-left: 5px;
        width: 50px;
        /* Ajustado para 50px em mobile */
        font-size: 20px;
        /* Ícone menor */
    }

    .main-nav {
        flex-direction: column;
        gap: 8px;
        width: 100%;
        display: none;
        padding-top: 10px;
        align-items: center;
    }

    .main-nav.expanded {
        display: flex;
    }

    .main-nav .button {
        width: 100%;
        margin: 0;
    }

    .container {
        padding: 15px;
        /* Menor padding interno */
        margin: 10px auto;
    }

    h2,
    h3,
    h4 {
        font-size: 1.3em;
        /* Títulos menores */
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        border-radius: 8px;
        overflow: hidden;
    }

    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }

    td:before {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #555;
    }

    /* Mapeamento responsivo para client_root_dashboard.php */
    .client-root-table td:nth-of-type(1):before {
        content: "ID";
    }

    .client-root-table td:nth-of-type(2):before {
        content: "Usuário";
    }

    .client-root-table td:nth-of-type(3):before {
        content: "Função";
    }

    .client-root-table td:nth-of-type(4):before {
        content: "CODIGOCLI";
    }

    .client-root-table td:nth-of-type(5):before {
        content: "Nome Fornecedor";
    }

    .client-root-table td:nth-of-type(6):before {
        content: "Vendedor";
    }

    .client-root-table td:nth-of-type(7):before {
        content: "Email";
    }

    .client-root-table td:nth-of-type(8):before {
        content: "Telefone";
    }

    .client-root-table td:nth-of-type(9):before {
        content: "Status";
    }

    .client-root-table td:nth-of-type(10):before {
        content: "Ações";
    }

    /* Mapeamento responsivo para client_communication.php */
    .communication-table td:nth-of-type(1):before {
        content: "Fornecedor";
    }

    .communication-table td:nth-of-type(2):before {
        content: "Usuário";
    }

    .communication-table td:nth-of-type(3):before {
        content: "Vendedor";
    }

    .communication-table td:nth-of-type(4):before {
        content: "Email";
    }

    .communication-table td:nth-of-type(5):before {
        content: "Telefone";
    }

    .communication-table td:nth-of-type(6):before {
        content: "Último Convite";
    }

    .communication-table td:nth-of-type(7):before {
        content: "Ação";
    }

    /* Mapeamento para supplier_dashboard.php e supplier_closed_quotations.php */
    .product-table td:nth-of-type(1):before {
        content: "CÓDIGO";
    }

    .product-table td:nth-of-type(2):before {
        content: "COD. BARRAS";
    }

    .product-table td:nth-of-type(3):before {
        content: "DESCRIÇÃO";
    }

    .product-table td:nth-of-type(4):before {
        content: "UN";
    }

    .product-table td:nth-of-type(5):before {
        content: "Preço";
    }

    .product-table td:nth-of-type(6):before {
        content: "Prazo (dias)";
    }

    .product-table td:nth-of-type(7):before {
        content: "Ação";
    }


    .floating-button {
        bottom: 10px;
        left: 10px;
        right: 10px;
        width: auto;
        padding: 12px 15px;
        font-size: 16px;
    }
}

/* Estilos para o botão de WhatsApp dentro da tabela */
.whatsapp-button {
    background-color: #25D366;
    /* Cor do WhatsApp */
    color: white;
    /* Texto branco */
    padding: 8px 15px;
    font-size: 0.9em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    /* Para alinhar ícone e texto */
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    /* Impede que o botão quebre linha */
    box-sizing: border-box;
    /* Garante que padding e border sejam incluídos na largura */
}

.whatsapp-button:hover {
    background-color: #1DA851;
}

.whatsapp-icon {
    margin-right: 5px;
}

/* Estilos para Modais */
.modal {
    /* Garante que o modal cubra toda a tela */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    /* Fundo semi-transparente */
    display: flex;
    /* Usa flexbox para centralizar o conteúdo */
    justify-content: center;
    /* Centraliza horizontalmente */
    align-items: center;
    /* Centraliza verticalmente */
    z-index: 1001;
    /* Maior que o header fixo */

    /* Oculto por padrão, ativado via JavaScript com a classe 'active' */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    display: flex;
    /* Força a exibição como flex para centralizar */
}

.modal-content {
    background-color: #fefefe;
    padding: 25px;
    border: 1px solid #888;
    border-radius: 12px;
    width: 90%;
    /* Largura em mobile */
    max-width: 550px;
    /* Largura máxima em desktop */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    /* Para posicionar o botão de fechar */
    overflow-y: auto;
    /* Adiciona scroll se o conteúdo for muito grande */
    max-height: 90vh;
    /* Limita a altura do modal para que caiba na tela */
    box-sizing: border-box;
    /* Inclui padding e border na largura/altura */
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 30px;
    font-weight: bold;
    position: absolute;
    /* Posiciona o botão de fechar */
    top: 10px;
    right: 20px;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Login Page Client ID Toggle */
.client-id-wrapper {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* Aligns the toggle to the right */
}

.client-id-toggle {
    cursor: pointer;
    font-size: 0.85em;
    color: #aaa;
    /* Discreet color */
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
    user-select: none;
    padding: 5px;
}

.client-id-toggle:hover {
    color: #777;
}

.client-id-input-container.hidden {
    display: none !important;
}

.client-id-input-container {
    width: 100%;
    /* Ensures the input takes full width when visible */
    margin-top: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}