/* ===== EHDS Orçador Simples - Estilos ===== */
:root {
    --primary: #0066b2;
    --primary-dark: #004d86;
    --primary-light: #e8f4fd;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #f5a623;
    --info: #17a2b8;
    --dark: #2c3e50;
    --gray: #6c757d;
    --gray-light: #f8f9fa;
    --border: #dee2e6;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
}

/* ===== LOGIN ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.login-container {
    background: #fff;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo img {
    max-width: 180px;
    margin-bottom: 15px;
}

.login-container h1 {
    color: var(--primary);
    margin-bottom: 25px;
    font-size: 1.4rem;
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 15px;
}

/* ===== NAVBAR ===== */
.navbar {
    background: #fff;
    box-shadow: var(--shadow);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.nav-logo {
    height: 35px;
    width: auto;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--gray);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-logout {
    color: var(--danger) !important;
}
.btn-logout:hover {
    background: #fde8e8 !important;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h1 {
    font-size: 1.5rem;
    color: var(--dark);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

.form-card {
    border-left: 4px solid var(--primary);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,102,178,0.1);
}

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.form-row .form-group.flex-2 {
    flex: 2;
}

.form-row .form-group.flex-1 {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 15px 20px;
    margin: 0 -20px -20px;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 10;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--dark);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: #e9ecef;
}

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #c82333;
}

.btn-info {
    background: var(--info);
    color: #fff;
}
.btn-info:hover {
    background: #138496;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 0.75rem;
    background: var(--gray-light);
    border: 1px solid var(--border);
}
.btn-xs:hover {
    background: #e2e6ea;
}

/* ===== TABLES ===== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.table th {
    background: var(--gray-light);
    font-weight: 600;
    color: var(--gray);
    font-size: 0.82rem;
    text-transform: uppercase;
}

.table tr:hover {
    background: #f8f9fc;
}

.table .actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

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

.input-table {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
}

.input-sm { max-width: 90px; }
.input-xs { max-width: 60px; }

.col-desc { width: 35%; }
.col-qtd { width: 10%; }
.col-un { width: 10%; }
.col-val { width: 15%; }
.col-total { width: 15%; }
.col-acoes { width: 15%; }

.text-center { text-align: center; }
.text-right { text-align: right; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-rascunho {
    background: #fff3cd;
    color: #856404;
}

.badge-finalizado {
    background: #d4edda;
    color: #155724;
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ===== NOTIFICATION TOAST ===== */
.notification {
    position: fixed;
    top: 70px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.9rem;
    z-index: 9999;
    animation: slideIn 0.3s ease;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.notification-success { background: var(--success); }
.notification-error { background: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== SEARCH BAR ===== */
.search-bar {
    margin-bottom: 15px;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.9rem;
}

/* ===== AUTOCOMPLETE ===== */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 5px 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: none;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-item:hover {
    background: var(--primary-light);
}

.autocomplete-item strong {
    display: block;
    font-size: 0.9rem;
}

.autocomplete-item small {
    color: var(--gray);
    font-size: 0.8rem;
}

/* ===== INFO BOX ===== */
.info-box {
    background: var(--gray-light);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 12px;
    margin-top: 10px;
}

.info-box p {
    margin-bottom: 3px;
    font-size: 0.88rem;
}

/* ===== TOTAIS ===== */
.totais-grid {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.totais-resumo {
    flex: 1;
    min-width: 250px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.total-geral {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.desconto-row {
    color: var(--danger);
}

/* ===== FILTROS ===== */
.filtros-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filtros-row .form-group {
    flex: 1;
    min-width: 150px;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius);
    padding: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    border: none;
    padding: 0;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    padding: 5px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 10px;
    }

    .nav-links {
        justify-content: center;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        min-width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .totais-grid {
        flex-direction: column;
    }

    .table .actions {
        flex-direction: column;
        gap: 2px;
    }

    .sticky-actions {
        flex-direction: column;
    }
}

/* ===== HR ===== */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}
