:root {
    --primary-blue: #026992;
    --dark-blue: #153147;
    --bg-light: #FAF8F6;
    --bg-white: #FFFFFF;
    --text-main: #272123;
    --gray-accent: #C7BD84;
    --gray-light: #E0DFD8;
    --gray-dark: #AFAFAF;

    /* Admin Colors */
    --success-green: #2ecc71;
    --warning-orange: #f39c12;
    --danger-red: #e74c3c;
}

/* -- RESET & GLOBAL
----------------------------------*/
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    color: var(--dark-blue);
    margin-top: 0;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* -- UTILS
----------------------------------*/
.direita { float: right; }
.esquerda { float: left; }
.agulha { clear: both; }

.coluna {
    display: flex;
    flex-direction: column;
}

.row-evenly {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
}

.row-left {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
}

/* Width Utils */
.p { width: 50px !important; }
.m { width: 70px !important; }
.g { width: 100px !important; }
.gg { width: 200px !important; }
.xg { width: 255px !important; }
.xgg { width: 350px !important; }
.auto { width: 100%; }

/* Height Utils */
.h-pp { height: 24px !important; }
.h-p { height: 50px !important; }
.h-m { height: 70px !important; }
.h-g { height: 100px !important; }

/* Gap Utils */
.gap-pp { gap: 2px !important; }
.gap-p { gap: 5px !important; }
.gap-m { gap: 10px !important; }
.gap-g { gap: 15px !important; }
.gap-gg { gap: 20px !important; }
.m-auto { margin: auto; }

/* -- HEADER / NAVBAR
----------------------------------*/
nav {
    background-color: var(--dark-blue);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 10%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.logo-link img {
    height: 50px;
}

#nav-itens {
    display: flex;
    gap: 30px;
    align-items: center;
    margin-left: auto;
}

#nav-itens li {
    height: 100%;
    display: flex;
    align-items: center;
}

#nav-itens li a {
    color: #fff;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 5px 0;
    position: relative;
    font-family: 'Montserrat', sans-serif;
    white-space: nowrap;
}

#nav-itens li a:not(.btn-nav)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    background-color: var(--gray-accent);
    transition: width 0.3s ease;
}

#nav-itens li a:not(.btn-nav):hover::after,
#nav-itens li a.active::after {
    width: 100%;
}

.btn-nav {
    border: 1px solid var(--gray-accent);
    padding: 8px 20px !important;
    border-radius: 8px;
    color: var(--gray-accent) !important;
}

.btn-nav:hover {
    background-color: var(--gray-accent);
    color: var(--dark-blue) !important;
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.menu-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: #fff;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-toggle.open .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.open .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.open .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* -- DROPDOWN MENU (Admin features)
----------------------------------*/
.has-submenu {
    position: relative;
    cursor: pointer;
}

.submenu {
    display: none;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background-color: var(--dark-blue);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-radius: 0 0 5px 5px;
    padding: 5px 0;
    z-index: 9999;
    transition: all 0.3s ease;
}

.submenu::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
}

/* Fix specificity issues with main nav styles */
#nav-itens .submenu li {
    display: block;
    height: auto;
    margin: 0;
    padding: 0;
}

#nav-itens .submenu li a {
    display: block;
    width: 100%;
    padding: 10px 20px !important; /* Force overrides */
    box-sizing: border-box;
    color: #fff;
    font-size: 0.9rem;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
}

#nav-itens .submenu li a:hover {
    background-color: var(--primary-blue) !important;
    color: #fff;
}

/* Submenu underline effect matches main menu */
#nav-itens .submenu li a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    background-color: var(--gray-accent);
    transition: width 0.3s ease;
    display: block !important;
}

#nav-itens .submenu li a:hover::after {
    width: 100%;
}

.has-submenu:hover .submenu {
    display: block;
    opacity: 1;
    visibility: visible;
}

/* -- ADMIN SPECIFIC STYLES -- */

/* Admin Main Container */
.admin-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    width: 100%;
    flex: 1;
}

/* Dashboard Grid */
.dashboard-header {
    margin-bottom: 40px;
}
.dashboard-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}
.dashboard-header p {
    color: #666;
    font-style: italic;
}

/* Quick Actions Cards */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.action-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-left: 5px solid var(--primary-blue);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.action-card h3 {
    margin: 0 0 10px 0;
    color: var(--dark-blue);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-card p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.card-orcamento { border-left-color: var(--primary-blue); }
.card-pedido { border-left-color: var(--warning-orange); }
.card-os { border-left-color: var(--success-green); }

/* Drivers and Links Grid */
.drivers-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--gray-light);
    padding-bottom: 10px;
}

.drivers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.driver-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--gray-light);
    transition: all 0.2s;
    text-decoration: none;
    color: var(--dark-blue);
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.driver-item:hover {
    border-color: var(--primary-blue);
    background-color: #f0f7fa;
}

/* -- LOGIN PAGE (Vertical Split / Side-by-Side) -- */
.login-body {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: row;
    background-color: white;
    overflow: hidden;
}

.login-left {
    height: 100vh;
    width: 40%;
    background-color: var(--dark-blue);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    padding: 40px;
    background-image: linear-gradient(135deg, var(--dark-blue) 0%, var(--primary-blue) 100%);
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 2;
}

.login-left img {
    max-width: 250px;
    margin-bottom: 10px;
}

.login-left h2 {
    color: white;
    font-weight: 300;
    letter-spacing: 1px;
    font-size: 1.5rem;
}

.login-right {
    height: 100vh;
    width: 60%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background-color: #f9f9f9;
    overflow-y: auto;
}

.login-box {
    width: 100%;
    max-width: 450px;
    padding: 50px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    margin-top: 0;
    text-align: center;
}

/* Responsividade para Celulares (Volta ao padrão antigo) */
@media (max-width: 768px) {
    nav {
        padding: 1rem 5%;
    }

    .menu-toggle {
        display: flex;
    }

    #nav-itens {
        position: absolute;
        top: 70px;
        right: 0;
        width: 100%;
        background-color: var(--dark-blue);
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    #nav-itens.active {
        max-height: 500px;
        padding: 10px 0;
    }

    #nav-itens li {
        width: 100%;
        justify-content: center;
        padding: 12px 0;
    }

    .login-body {
        flex-direction: column;
    }
    .login-left {
        width: 100%;
        height: 35vh;
        padding: 20px;
    }
    .login-right {
        width: 100%;
        height: 65vh;
        align-items: flex-start;
        padding: 20px;
    }
    .login-box {
        padding: 30px;
        margin-top: -40px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
}

.login-box h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--dark-blue);
}

.login-box p.subtitle {
    color: #888;
    margin-bottom: 25px;
}

/* -- FORMS (Unified)
----------------------------------*/
form {
    text-align: left;
    max-width: 100%;
    margin: auto;
}

.titulo-formulario {
    max-width: 1200px;
    margin: 30px auto 10px;
    padding: 0 20px;
    color: var(--dark-blue);
}

#main-pesquisa {
    max-width: 1200px;
    margin: 20px auto 60px;
    padding: 0 20px;
}

#main-pesquisa form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#main-pesquisa .row-left {
    flex-wrap: wrap;
    gap: 20px;
}

#main-pesquisa .coluna {
    flex: 1;
    min-width: 220px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-main);
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    margin: 4px 0 10px 0;
    display: inline-block;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    box-sizing: border-box;
    font-family: 'Open Sans', sans-serif;
    color: var(--text-main);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
    min-height: 40px;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(2, 105, 146, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.btn-login:hover {
    background-color: #025272;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    border-left: 4px solid #c62828;
}

button, input[type="submit"] {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 10px 20px;
}

button:hover, input[type="submit"]:hover {
    background-color: var(--dark-blue);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.endereco-bloco { 
    border: 1px solid var(--gray-light); 
    padding: 15px; 
    margin-bottom: 15px; 
    border-radius: 5px; 
    background: #f9f9f9;
}

.endereco-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px; 
}

.lista-anexos { 
    list-style-type: none; 
    padding-left: 0; 
}

.lista-anexos li {
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 8px; 
    border-bottom: 1px solid #ddd; 
}

.lista-anexos a.excluir {
    color: var(--danger-red); 
    margin-left: 15px; 
}

.btn-pdf {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-blue); 
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 100;
}

/* -- BREADCRUMB NAVIGATION -- */
.breadcrumb {
    background-color: transparent;
    padding: 10px 0;
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 5px;
}

.breadcrumb a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.breadcrumb a:hover {
    text-decoration: underline;
    color: var(--primary-blue);
}

.breadcrumb p {
    margin: 0;
    color: var(--gray-dark);
    font-weight: bold;
    user-select: none;
}

.breadcrumb .active {
    color: var(--text-main);
    pointer-events: none;
    cursor: default;
}

/* -- FILTERS AND TABLES (Legacy/Historico)
----------------------------------*/
section#filtros {
    width: 100%;
    overflow: visible;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

/* Left side of filters (Links/Buttons) */
#filtros .esquerda {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Right side of filters (Search) */
#filtros .direita {
    display: flex;
    align-items: center;
}

/* Consistência dos botões */
#filtros a, 
#filtros button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px;
    box-sizing: border-box;
    text-transform: uppercase;
    line-height: 1;
}

#filtros a {
    background: var(--primary-blue);
    color: #FFF;
    border: 1px solid var(--primary-blue);
}

#filtros a:hover {
    background: var(--dark-blue);
    border-color: var(--dark-blue);
}

#filtros button {
    background: #FFF;
    color: var(--danger-red);
    border: 1px solid var(--danger-red);
}

#filtros button:hover {
    background: var(--danger-red);
    color: #FFF;
}

#filtros input {
    padding: 5px 10px;
    color: #7D8081;
    border: 2px solid #ccc;
    border-radius: 0.5rem;
}

table.lista-pedidos {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-family: Arial, sans-serif;
    font-size: 15px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 8px rgba(0,0,0,0.1);
}

table.lista-pedidos th,
table.lista-pedidos td {
    text-align: left;
    padding: 12px 16px;
}

table.lista-pedidos thead {
    background-color: #f0f0f0;
    font-weight: bold;
}

table.lista-pedidos tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

table.lista-pedidos tbody tr:hover {
    background-color: #eaeaea;
    cursor: pointer;
}

/* Sortable headers */
th.sortable a { color: inherit; text-decoration: none; display: block; }
th.sortable a:hover { color: var(--primary-blue); }
th.sorted-asc a::after { content: " ▲"; font-size: 0.8em; }
th.sorted-desc a::after { content: " ▼"; font-size: 0.8em; }

/* Status Badges */
.status-badge {
    padding: 5px 10px;
    border-radius: 15px;
    color: white;
    font-weight: bold;
    font-size: 0.9em;
    cursor: pointer;
    border: none;
    min-width: 120px;
    text-align: center;
    display: inline-block;
}

.status-Atendido, .status-atendido { background-color: #08bd35; }
.status-Em-Aberto, .status-em-aberto { background-color: #6c757d; }
.status-Em-Andamento, .status-em-andamento { background-color: #ebdc09; }
.status-Aprovado, .status-aprovado { background-color: #0841bd; }
.status-Cancelado, .status-cancelado { background-color: #7f099c; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* -- LEGACY FORM STANDARDIZATION OVERRIDES
   Applies modern styling to legacy forms in area-funcionario/nav/
----------------------------------*/

#main-pesquisa form {
    background-color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

#main-pesquisa form input[type="text"],
#main-pesquisa form input[type="password"],
#main-pesquisa form input[type="email"],
#main-pesquisa form input[type="number"],
#main-pesquisa form input[type="date"],
#main-pesquisa form select,
#main-pesquisa form textarea {
    height: auto !important;
    min-height: 45px !important;
    padding: 10px 15px !important;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background-color: #fff;
    color: var(--text-main);
    font-size: 0.95rem;
    box-shadow: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    margin-bottom: 5px;
}

#main-pesquisa form textarea {
    min-height: 120px !important;
    resize: vertical;
}

#main-pesquisa form input:focus,
#main-pesquisa form select:focus,
#main-pesquisa form textarea:focus {
    border-color: var(--primary-blue);
    outline: none;
    box-shadow: 0 0 0 4px rgba(2, 105, 146, 0.1);
}

#main-pesquisa form label {
    font-weight: 600;
    color: var(--dark-blue);
    margin-bottom: 8px;
    display: block;
    font-size: 0.9rem;
}

/* Buttons normalization */
#main-pesquisa form button,
#main-pesquisa form input[type="submit"],
#main-pesquisa .btn-enviar {
    height: 45px;
    padding: 0 30px;
    border-radius: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    background-color: var(--primary-blue);
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

#main-pesquisa form button:hover,
#main-pesquisa form input[type="submit"]:hover {
    background-color: var(--dark-blue);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Repeater specific styling (Product and Service list) */
#main-pesquisa .item-produto,
#main-pesquisa .item-servico {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    width: 100%;
    padding: 15px 10px;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    background-color: #fafafa;
    margin-bottom: 10px;
    gap: 10px;
}

.item-produto .produto-autocomplete,
.item-servico .servico-autocomplete {
    flex-grow: 1;
    min-width: 150px;
    width: auto !important;
}

/* Override utility widths inside form to accommodate new padding */
#main-pesquisa form .h-pp { height: auto !important; }
#main-pesquisa form .p { width: 60px !important; }
#main-pesquisa form .m { width: 90px !important; }
#main-pesquisa form .g { width: 140px !important; }
#main-pesquisa form .gg { width: 220px !important; }

/* Excluir button in repeater */
#main-pesquisa .btn-excluir {
    background-color: transparent !important;
    color: var(--danger-red) !important;
    border: 1px solid var(--danger-red) !important;
    min-width: 45px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

#main-pesquisa .btn-excluir:hover {
    background-color: var(--danger-red) !important;
    color: white !important;
}

/* Column full width adjustments */
#main-pesquisa .coluna input,
#main-pesquisa .coluna select,
#main-pesquisa .coluna textarea {
    width: 100%;
}

/* Section titles */
#main-pesquisa h3 {
    font-size: 1.2rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--dark-blue);
    display: flex;
    align-items: center;
}

/* Styles for disabled inputs to look distinct */
#main-pesquisa form input:disabled {
    background-color: #f5f5f5;
    color: #888;
    border-color: #e0e0e0;
}
