/* =======================================================
   1. RESET BÁSICO E ESTRUTURA GLOBAL
   ======================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
body { background-color: #f8f9fa; padding: 0px; }
html, body { max-width: 100vw; overflow-x: hidden; } /* Previne rolagem horizontal indesejada */

.container { background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); max-width: 600px; margin: auto; }
h2 { margin-bottom: 24px; color: #202124; font-weight: 400; }

.row { margin-right: 0 !important; margin-left: 0 !important; }

/* =======================================================
   2. FORMULÁRIOS E INPUTS (Novo Padrão Google Borda Completa)
   ======================================================= */
.input-group {
    position: relative;
    margin-bottom: 25px;
    width: 100%;
}

/* ADICIONADOS type="email" e type="password" NA LISTA ABAIXO! */
.input-group input[type="text"],
.input-group input[type="email"],
.input-group input[type="password"],
.input-group input[type="date"],
.input-group input[type="number"],
.input-group input[type="time"],
.input-group select,
.input-group textarea,
.select-google {
    width: 100%;
    padding: 14px 15px;
    font-size: 15px;
    color: #3c4043;
    background-color: transparent;
    border: 1px solid #dadce0;
    border-radius: 8px; /* Cantos arredondados */
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

/* Label pousado na linha de cima (Fixo) */
.input-group label {
    position: absolute;
    top: -9px;
    left: 12px;
    font-size: 12px;
    color: #5f6368;
    background-color: white;
    padding: 0 4px;
    font-weight: 600;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1;
}

/* Efeito ao clicar (Fica com a cor Verde da ILPI) */
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus,
.select-google:focus {
    border-color: #5ddb60;
    /* Removido o border-width de 2px, mantendo a espessura original (1px) */
    /* Removido o padding diferente e o :valid que deixava tudo verde */
}

/* Muda a cor do título para verde SOMENTE quando focado */
.input-group input:focus ~ label,
.input-group select:focus ~ label,
.input-group textarea:focus ~ label {
    color: #5ddb60;
}

/* Checkboxes (Ex: Intelecto cognitivo com limitação) */
.input-group-checkbox {
    display: flex;
    align-items: center;
    height: 50px;
    margin-bottom: 25px;
}
.input-group-checkbox label {
    position: static;
    font-size: 15px;
    color: #3c4043;
    background: transparent;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}
.input-group-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #5ddb60;
    cursor: pointer;
    margin: 0;
}

/* =======================================================
   3. BOTÕES
   ======================================================= */
.btn-google {
    background-color: #1a73e8;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    transition: background-color 0.2s, box-shadow 0.2s;
}
.btn-google:hover {
    background-color: #1b66c9;
    box-shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
}

.btn-green {
    background-color: #5ddb60;
    color: #ffffff;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
    transition: background-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-green:hover {
    background-color: #4cc74f;
    box-shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
    color: #ffffff;
}

.btn-flat {
    background: transparent;
    border: none;
    color: #1a73e8;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease;
    font-family: inherit;
}
.btn-flat:hover { background: #e8f0fe; }
.btn-flat .material-icons { font-size: 18px; }

/* =======================================================
   4. SIDEBAR E MENU PRINCIPAL
   ======================================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 90px; /* Padrão Fechado */
    background-color: #ffffff;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: width 0.3s ease;
    overflow-x: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.main-content {
    margin-left: 90px;
    padding: 30px;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

/* Menu Toggle (Hambúrguer) */
.menu-toggle {
    padding: 18px 0 0 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    align-content: center;
    color: #5f6368;
    transition: background 0.2s;
}
.menu-toggle:hover { background-color: #f1f3f4; }

/* Item do Menu Fechado */
.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 5px;
    color: #3c4043;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
    white-space: normal;
}
.menu-item:hover, .menu-item.ativo {
    background-color: #eafbe7;
    color: #5ddb60;
}
.menu-item .material-icons {
    font-size: 24px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}
.menu-text {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
    word-break: break-word;
    transition: all 0.2s ease;
}

/* Comportamento Menu Aberto */
.sidebar.expanded { width: 250px; }
.sidebar.expanded ~ .main-content { margin-left: 250px; }

.sidebar.expanded .menu-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 15px 20px;
    white-space: nowrap;
}
.sidebar.expanded .menu-item .material-icons { margin-bottom: 0; min-width: 25px; }
.sidebar.expanded .menu-text { font-size: 14px; margin-left: 15px; opacity: 1; }

/* =======================================================
   5. TABELAS E COMPONENTES ESPECÍFICOS
   ======================================================= */
/* Layout Listagens */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    overflow-x: auto;
}

.table-google { width: 100%; border-collapse: collapse; }
.table-google th, .table-google td { padding: 16px; text-align: left; border-bottom: 1px solid #e0e0e0; color: #3c4043; font-size: 14px; }
.table-google th { background-color: #ffffff; color: #5f6368; font-weight: 500; }
.table-google tr:last-child td { border-bottom: none; }
.table-google tr:hover { background-color: #f8f9fa; }
.action-links a { color: #1a73e8; text-decoration: none; margin-right: 15px; font-weight: 500; }

/* Autocomplete */
.autocomplete-lista {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    list-style: none;
    margin-top: 2px;
    display: none;
}
.autocomplete-item { padding: 10px 15px; cursor: pointer; font-size: 14px; color: #3c4043; border-bottom: 1px solid #f1f3f4; transition: background 0.2s; }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background-color: #eafbe7; color: #5ddb60; }
.autocomplete-destaque { font-weight: bold; color: #5ddb60; }

/* Accordion de Lotes */
.accordion-row { display: none; }
.accordion-content { background-color: #f8f9fa; padding: 20px; border-bottom: 1px solid #e0e0e0; box-shadow: inset 0 3px 6px -3px rgba(0,0,0,0.1); }
.lotes-table { width: 100%; border-collapse: collapse; background: #ffffff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.lotes-table th, .lotes-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #f1f3f4; font-size: 13px; color: #3c4043; }
.lotes-table th { background-color: #eafbe7; color: #5ddb60; font-weight: 500; }
.lotes-table tr:last-child td { border-bottom: none; }
.data-validade { font-weight: 500; }
.btn-acao-lote { background: transparent; border: none; cursor: pointer; margin-right: 10px; color: #5f6368; transition: color 0.2s; }
.btn-acao-lote.edit:hover { color: #1a73e8; }
.btn-acao-lote.delete:hover { color: #ea4335; }

/* Linhas Dinâmicas de Estoque */
.linha-lote { display: flex; flex-direction: row; gap: 15px; align-items: flex-end; margin-bottom: 15px; background: #f8f9fa; padding: 15px; border-radius: 8px; position: relative; width: 100%; }
.linha-lote .input-group { flex: 1; margin-bottom: 0; }
.btn-remover-lote { background: transparent; border: none; color: #ea4335; cursor: pointer; padding: 10px; transition: color 0.2s; display: flex; align-items: center; justify-content: center; }
.btn-remover-lote:hover { color: #c5221f; }
.espacador-lote { width: 44px; }


/* =======================================================
   6. RESPONSIVIDADE (MOBILE)
   ======================================================= */
.mobile-topbar { display: none; }
.overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.5); z-index: 998; opacity: 0; transition: opacity 0.3s ease; }

@media (max-width: 768px) {
    body { padding: 5px; }
    .container, .table-container { padding: 10px 13px; }

    /* Topbar e Sidebar Mobile */
    .mobile-topbar { display: flex; align-items: center; background-color: #ffffff; color: #5f6368; height: 56px; padding: 0 16px; position: fixed; top: 0; left: 0; width: 100%; z-index: 900; box-shadow: 0 2px 4px rgba(0,0,0,0.1); border-bottom: 1px solid #e0e0e0; }
    .mobile-topbar i { margin-right: 16px; cursor: pointer; }
    .mobile-title { font-size: 18px; font-weight: 500; }
    #menu-toggle-desktop { display: none; }

    .sidebar { width: 250px; transform: translateX(-100%); z-index: 999; }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar .menu-item { flex-direction: row; justify-content: flex-start; padding: 15px 20px; }
    .sidebar .menu-item .material-icons { margin-bottom: 0; min-width: 25px; }
    .sidebar .menu-text { font-size: 14px; margin-left: 15px; white-space: nowrap; }

    .main-content { margin-left: 0; margin-top: 56px; padding: 0px; }
    .sidebar.expanded ~ .main-content { margin-left: 0; }
    .overlay.active { display: block; opacity: 1; }

    /* Lotes Estoque Mobile */
    .linha-lote { flex-direction: column; align-items: stretch; gap: 20px; padding-bottom: 50px; }
    .linha-lote .input-group { width: 100%; }
    .btn-remover-lote { position: absolute; bottom: 10px; right: 10px; background-color: #fce8e6; border-radius: 4px; padding: 5px 15px; }
    .espacador-lote { display: none; }

    /* Formulários Mobile */
    .form-row-responsive { flex-direction: column !important; gap: 20px !important; }
    .form-row-responsive > div { margin-bottom: 0 !important; width: 100%; }
    .mobile-side-by-side { display: flex !important; flex-direction: row !important; gap: 15px !important; width: 100%; align-items: flex-end; }
}

@media (max-width: 380px) {
    .mobile-side-by-side { flex-direction: column !important; }
}