/* =========================================
   1. IMPORTAÇÕES E VARIÁVEIS
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    /* Cores da Marca */
    --brand-neon: #00E083;
    --brand-neon-hover: #00C976;

    /* Fundos */
    --bg-body: #000000;
    --bg-surface: #060606;
    --bg-surface-hover: #18181B;
    --bg-highlight: #02120D;
    --bg-glass-surface: rgba(0, 0, 0, 0.8);
    --bg-glass: rgba(0, 224, 131, 0.15);
    --bg-glass-hover: rgba(0, 224, 131, 0.25);

    /* Bordas */
    --border-subtle: rgba(255, 255, 255, 0.10);
    --border-focus: #006D4B;
    --border-detach: rgba(0, 224, 131, 0.2);

    /* Texto */
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E8E;
    --text-muted: #5A5A5A;

    /* Status e Alertas */
    --status-danger: #DD0000;
    --status-warning: #FFC107;
    --status-orange: #FF8C00;
    --danger-bg: rgba(103, 25, 25, 0.3);
    --danger-bg-hover: rgba(171, 12, 12, 0.3);

    /* Medidas (Radius) */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

/* =========================================
   2. RESET E ESTILOS BASE
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Montserrat", sans-serif;
    -webkit-font-smoothing: antialiased;
}

html {
    font-size: 100%;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
}

@media (min-width: 1024px) {
    html {
        font-size: 93.75%;
    }
}

/* =========================================
   3. TIPOGRAFIA E ELEMENTOS GERAIS
   ========================================= */
h1, h2, h3, h4 {
    line-height: 1.2;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

a {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

ul {
    list-style: none;
}

input {
    color: #FFFFFF;
}

input:focus,
button:focus {
    outline: none;
}

/* =========================================
   4. CLASSES UTILITÁRIAS
   ========================================= */
.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.hidden {
    display: none;
}

/* Cor */
.text-neon    { color: var(--brand-neon); }
.text-warning { color: var(--status-warning); }
.text-orange  { color: var(--status-orange); }
.text-danger  { color: var(--status-danger); }
.link-neon    { color: var(--brand-neon); text-decoration: underline; }

/* Espaçamento */
.mt-1 { margin-top: 1rem; }

/* Layout flex */
.flex-center  { display: flex; align-items: center; gap: 8px; }
.flex-col     { display: flex; flex-direction: column; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Texto */
.text-right    { text-align: right; }
.text-xs-muted { font-size: 0.75rem; color: var(--text-muted); }

/* =========================================
   5. COMPONENTE: TOAST NOTIFICATION (Top Drop Pílula)
   ========================================= */
#toast-container {
    position: fixed;
    top: 2rem;
    
    /* Centraliza o container no topo da tela */
    left: 50%;
    transform: translateX(-50%);
    
    display: flex;
    flex-direction: column;
    align-items: center; /* Garante que se tiverem 2 toasts, eles fiquem alinhados no meio */
    gap: 10px;
    z-index: 99999;
    pointer-events: none;
    width: 100%;
}

.toast {
    width: auto;
    max-width: 90%; /* Proteção para o texto não encostar nas bordas de telas pequenas */
    
    background-color: #121214; /* Fundo descolado do preto chapado */
    border: 1px solid var(--border-subtle);
    padding: 12px 24px;
    border-radius: 100px; /* A mágica do formato Pílula */
    
    display: flex;
    align-items: center;
    gap: 12px;
    
    box-shadow: 0 15px 35px rgba(0,0,0,0.8);
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: auto;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.toast:active {
    cursor: grabbing;
}

/* =========================================
   CORES DO TOAST (Bordas e Ícones)
   ========================================= */
.toast.success { border-left: 3px solid var(--brand-neon); }
.toast.warning { border-left: 3px solid #FFC107; }
.toast.error   { border-left: 3px solid var(--status-danger); }
.toast.default { border-left: 3px solid var(--text-secondary); }

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.toast.success .toast-icon { color: var(--brand-neon); }
.toast.warning .toast-icon { color: #FFC107; }
.toast.error .toast-icon   { color: var(--status-danger); }
.toast.default .toast-icon { color: var(--text-secondary); }

.toast-message {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Animação unificada de queda (Top Drop) */
@keyframes slideDown {
    from { transform: translateY(-150%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* =========================================
   6. COMPONENTE: HEADER DE PÁGINA
   ========================================= */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

@media (max-width: 500px) {
    .page-header h2 { font-size: 1.25rem; }
    .page-header { margin-bottom: 1rem; }
}

/* =========================================
   7. ANIMAÇÕES GLOBAIS
   ========================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fluidReveal {
    0% {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* =========================================
   8. CORREÇÃO DO AUTOCOMPLETE (AUTOFILL) DO NAVEGADOR
   ========================================= */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    /* Usa uma sombra interna gigante para cobrir o branco com o nosso fundo escuro */
    -webkit-box-shadow: 0 0 0 50px #09090b inset !important;
    
    /* Força o texto preenchido a ficar branco */
    -webkit-text-fill-color: var(--text-primary) !important;
    
    /* Remove a transição padrão do autofill */
    transition: background-color 5000s ease-in-out 0s;
}

/* =========================================
   BLINDAGEM ANTI-ZOOM DO iOS (SAFARI)
   ========================================= */

/* 1. Impede o zoom ao clicar para digitar */
input, 
textarea, 
select {
    font-size: 13px !important;
}

/* 2. Desativa o zoom de "duplo clique" em botões e links */
button, 
a, 
.action-btn,
.mobile-navbar li {
    touch-action: manipulation !important;
}

/* ==========================================================================
   ✨ SKELETON LOADERS GLOBAIS (Feedback Visual de Carregamento)
========================================================================== */
@keyframes skeleton-shimmer {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

@keyframes skeleton-sweep {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-item {
    background: #232a3d;
    border-radius: 4px;
    animation: skeleton-shimmer 1.5s infinite linear;
    display: inline-block;
    height: 16px;
}

/* Variações para as diferentes telas do sistema */
.sk-number { width: 60px; height: 32px; border-radius: 6px; }
.sk-title { width: 60%; height: 24px; border-radius: 6px; }
.sk-text { width: 80px; height: 14px; }
.sk-card { width: 100%; height: 110px; border-radius: var(--radius-md); }
.sk-input { width: 100%; height: 44px; border-radius: var(--radius-md); }

/* Skeleton para os cards do grid de veículos */
.skeleton-car-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    pointer-events: none;
}

.skeleton-car-card .sk-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #1a1a1a 25%, #383838 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: skeleton-sweep 1.5s infinite linear;
}

.skeleton-car-card .sk-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.skeleton-car-card .sk-line {
    border-radius: 4px;
    background: linear-gradient(90deg, #1a1a1a 25%, #383838 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: skeleton-sweep 1.5s infinite linear;
    height: 14px;
}

.skeleton-car-card .sk-line:nth-child(1) { width: 80%; height: 18px; animation-delay: 0.08s; }
.skeleton-car-card .sk-line:nth-child(2) { width: 55%; animation-delay: 0.16s; }
.skeleton-car-card .sk-line:nth-child(3) { width: 40%; height: 24px; animation-delay: 0.24s; }
.skeleton-car-card .sk-line:nth-child(4) { width: 65%; animation-delay: 0.32s; }
.skeleton-car-card .sk-line:nth-child(5) { width: 45%; animation-delay: 0.4s; }

/* =========================================
   KPI CARDS (Componente Global)
   ========================================= */
.kpi-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-focus);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.kpi-card.detach {
    color: var(--brand-neon);
    border: 1px solid var(--border-focus);
    background-color: rgba(0, 224, 131, 0.05);
}

.kpi-card .card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.kpi-card .card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.kpi-card .icon-box {
    height: 24px;
    width: 24px;
    font-size: 0.75rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-focus);
    background-color: var(--bg-highlight);
    color: var(--brand-neon);
}

.kpi-card .icon-box.warning {
    border-color: rgba(255, 193, 7, 0.5);
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--status-warning);
}

.kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-value.contrast { color: var(--brand-neon); }

.kpi-footer {
    font-size: 12px;
    margin-top: 4px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-card.detach .kpi-footer { color: var(--brand-neon); }

/* =========================================
   COMPONENTE: INPUT GROUP + INPUT WRAPPER
   ========================================= */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 13.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper > i:first-child {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

/* =========================================
   COMPONENTE: MODAL OVERLAY (.modal-overlay)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.modal-window {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: calc(100% - 2rem);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay:not(.hidden) .modal-window {
    transform: translateY(0) scale(1);
}

.modal-header {
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;

    & i {
        color: var(--brand-neon);
    }
}

.modal-header h4 {
    font-size: 15.2px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.modal-header h3 i { color: var(--brand-neon); }

.modal-body {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.modal-body input[type="text"] {
    background-color: #09090b;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-size: 0.9rem !important;
}

.modal-body input[type="text"]:focus {
    border-color: var(--brand-neon);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
}

.btn-close:hover { color: var(--text-primary); }

/* Modal de exclusão (delete-window) */
.modal-window.delete-window {
    max-width: 380px;
    padding: 2rem;
    text-align: center;
    gap: 1.5rem;
    align-items: center;
}

.icon-header {
    display: flex;
    justify-content: center;
    width: 100%;
}

.icon-circle {
    width: 64px;
    height: 64px;
    background-color: rgba(221, 0, 0, 0.1);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--status-danger);
    font-size: 32px;
    border: 1px solid rgba(221, 0, 0, 0.2);
    box-shadow: 0 0 20px rgba(221, 0, 0, 0.1);
}

.icon-circle.icon-circle-success {
    background-color: rgba(0, 224, 131, 0.1);
    color: var(--brand-neon);
    border-color: rgba(0, 224, 131, 0.2);
    box-shadow: 0 0 20px rgba(0, 224, 131, 0.1);
}

.icon-circle.icon-circle-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--status-warning);
    border-color: rgba(255, 193, 7, 0.2);
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.1);
}

.delete-window .text-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.delete-window .text-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 280px;
    margin: 0 auto;
}

.btn-danger { background-color: var(--status-danger); color: white; }
.btn-danger:hover { background-color: #b90000; }

/* =========================================
   PADRÃO GLOBAL DE MODAIS (50/50)
========================================= */
.modal-footer {
    display: flex;
    gap: 8px;
    width: 100%;
    border-top: 1px solid var(--border-subtle);
    padding: 1rem;
    margin-top: 1.5rem;
}

/* Faz os botões ocuparem 50% cada */
.modal-footer button:not(.hidden),
.modal-footer .btn:not(.hidden) {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

/* Modificador para botões únicos ou centralizados */
.modal-footer.centered-footer {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0;
    border-top: none;
}

.modal-footer.centered-footer button,
.modal-footer.centered-footer .btn {
    flex: none;
    width: auto;
    min-width: 120px;
}

/* =========================================
   COMPONENTE: BOTÕES DE MODAL (GLOBAL)
   ========================================= */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-save {
    background-color: var(--brand-neon);
    color: #000;
}
.btn-save:hover { background-color: var(--brand-neon-hover); }

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-weight: 500;
}
.btn-cancel:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* badges */
.badge {
    border-radius: 1rem;
    padding: .25rem 1rem;
    
    font-weight: 600;
    font-size: 12px;
    
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    width: fit-content;
    cursor: default;
}

.badge--outline {
    background-color: var(--bg-glass);
    border: 2px solid #006139;
    color: var(--brand-neon);
}

.btn--outline {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-weight: 500;
}
.btn--outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn--primary {
    background-color: var(--brand-neon);
    transition: .3s all;
    font-size: 1rem;
}

.btn--primary:hover {
    background-color: var(--brand-neon-hover);
}