/* ========================================
   SISTEMA DE CONTROLE DE VEÍCULOS
   Estilos Globais - Mobile First
   ======================================== */

/* Reset e configurações base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --cor-primaria: #e30613;
    --cor-primaria-escura: #b30510;
    --cor-secundaria: #191970;
    --cor-secundaria-escura: #000080;
    --cor-cinza: #6c757d;
    --cor-cinza-escuro: #495057;
    --cor-cinza-claro: #f8f9fa;
    --cor-borda: #e0e0e0;
    --cor-sucesso: #28a745;
    --cor-erro: #dc3545;
    --cor-info: #17a2b8;
    --cor-texto: #212529;
    --cor-texto-secundario: #6c757d;
    --sombra-leve: 0 2px 5px rgba(0, 0, 0, 0.1);
    --sombra-media: 0 4px 20px rgba(0, 0, 0, 0.08);
    --sombra-forte: 0 6px 30px rgba(0, 0, 0, 0.15);
    --transicao-rapida: 0.2s ease;
    --transicao-normal: 0.3s ease;
    --border-radius: 8px;
    --border-radius-grande: 12px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    min-height: 100vh;
    color: var(--cor-texto);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   HEADER E NAVEGAÇÃO
   ======================================== */

header {
    background: linear-gradient(135deg, var(--cor-primaria) 0%, var(--cor-primaria-escura) 100%);
    color: white;
    text-align: center;
    padding: 1.2em 1em;
    box-shadow: 0 2px 10px rgba(227, 6, 19, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.3em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
}

nav {
    background-color: var(--cor-cinza);
    padding: 0.8em;
    text-align: center;
    box-shadow: var(--sombra-leve);
    position: sticky;
    top: 60px;
    z-index: 99;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.6em 1em;
    border-radius: var(--border-radius);
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    transition: var(--transicao-normal);
    font-weight: 500;
    margin: 0.2em;
    font-size: 0.9em;
}

nav a:hover,
nav a:focus {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    outline: none;
}

nav a:active {
    transform: translateY(0);
}

/* ========================================
   CONTAINERS E CARDS
   ======================================== */

.container {
    max-width: 1200px;
    margin: 1em auto;
    padding: 0.8em;
}

.card {
    background: white;
    border-radius: var(--border-radius-grande);
    box-shadow: var(--sombra-media);
    overflow: hidden;
    margin-bottom: 1.5em;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    background: linear-gradient(135deg, var(--cor-cinza-escuro) 0%, #343a40 100%);
    color: white;
    padding: 1em;
    font-weight: 600;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.card-body {
    padding: 1.2em;
}

/* ========================================
   MENSAGENS E ALERTAS
   ======================================== */

.message {
    padding: 1em;
    margin-bottom: 1.5em;
    border-radius: var(--border-radius);
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.8em;
    animation: slideDown 0.3s ease-out;
    line-height: 1.5;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message i {
    flex-shrink: 0;
    margin-top: 0.1em;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid var(--cor-sucesso);
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--cor-erro);
}

.warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--cor-info);
}

/* ========================================
   FORMULÁRIOS
   ======================================== */

.form-group {
    margin-bottom: 1.2em;
}

label {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: var(--cor-cinza-escuro);
    font-size: 0.9em;
}

label i {
    color: var(--cor-primaria);
    width: 18px;
    flex-shrink: 0;
}

label .required {
    color: var(--cor-erro);
    margin-left: 0.2em;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.8em;
    border: 2px solid var(--cor-borda);
    border-radius: var(--border-radius);
    font-size: 1em;
    text-transform: uppercase;
    transition: var(--transicao-normal);
    background-color: var(--cor-cinza-claro);
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--cor-primaria);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.1);
}

input:required,
select:required,
textarea:required {
    border-left: 3px solid var(--cor-primaria);
}

input::placeholder {
    text-transform: none;
    color: #999;
}

input:disabled,
select:disabled,
textarea:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========================================
   GRID E LAYOUT
   ======================================== */

.row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1em;
}

.full-width {
    grid-column: 1 / -1;
}

/* ========================================
   BOTÕES
   ======================================== */

.btn {
    padding: 0.9em 1.5em;
    border-radius: var(--border-radius);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transicao-normal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    border: none;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cor-secundaria) 0%, var(--cor-secundaria-escura) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(25, 25, 112, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 25, 112, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--cor-cinza) 0%, var(--cor-cinza-escuro) 100%);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--cor-erro) 0%, #c82333 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--cor-sucesso) 0%, #218838 100%);
    color: white;
}

.btn:disabled {
    background: linear-gradient(135deg, var(--cor-cinza) 0%, var(--cor-cinza-escuro) 100%);
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8em;
    margin-top: 1.5em;
}

.btn-block {
    width: 100%;
}

/* ========================================
   COMPONENTES ESPECIAIS
   ======================================== */

.docs-group {
    background-color: var(--cor-cinza-claro);
    padding: 1.2em;
    border-radius: var(--border-radius);
    border: 2px dashed #dee2e6;
    margin-top: 0.5em;
}

.docs-group.visible {
    border-color: var(--cor-primaria);
    background-color: #fff5f5;
}

.search-box {
    position: relative;
    margin-bottom: 1em;
}

.search-box input {
    padding-right: 3em;
}

.search-box i {
    position: absolute;
    right: 1em;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cor-cinza);
    pointer-events: none;
}

.badge {
    display: inline-block;
    padding: 0.3em 0.6em;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-primary {
    background-color: var(--cor-primaria);
    color: white;
}

.badge-success {
    background-color: var(--cor-sucesso);
    color: white;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-danger {
    background-color: var(--cor-erro);
    color: white;
}

.badge-info {
    background-color: var(--cor-info);
    color: white;
}

/* ========================================
   UTILITÁRIOS
   ======================================== */

.hidden {
    display: none !important;
}

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

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

.text-muted {
    color: var(--cor-texto-secundario);
}

.text-primary {
    color: var(--cor-primaria);
}

.text-success {
    color: var(--cor-sucesso);
}

.text-danger {
    color: var(--cor-erro);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ========================================
   ANIMAÇÕES
   ======================================== */

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fa-spinner,
.spinner {
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   SCROLLBAR CUSTOMIZADA
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   RESPONSIVIDADE - TABLET (576px+)
   ======================================== */

@media (min-width: 576px) {
    header h1 {
        font-size: 1.5em;
    }

    nav a {
        margin: 0 0.3em;
        font-size: 1em;
    }

    .container {
        padding: 1.5em;
    }

    .card-header {
        padding: 1.2em;
        font-size: 1.1em;
    }

    .card-body {
        padding: 1.8em;
    }

    .row {
        grid-template-columns: repeat(2, 1fr);
    }

    .row.three-cols {
        grid-template-columns: repeat(3, 1fr);
    }

    .btn-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn-group.three-btns {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   RESPONSIVIDADE - DESKTOP (768px+)
   ======================================== */

@media (min-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .container {
        margin: 2em auto;
    }

    .card-body {
        padding: 2em;
    }

    .row.four-cols {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   RESPONSIVIDADE - LARGE DESKTOP (992px+)
   ======================================== */

@media (min-width: 992px) {
    .container {
        padding: 2em;
    }

    .row.five-cols {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ========================================
   IMPRESSÃO
   ======================================== */

@media print {
    body {
        background: white;
    }

    header,
    nav,
    .btn,
    .message {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .card-header {
        background: #f0f0f0;
        color: #333;
    }
}

/* ========================================
   ACESSIBILIDADE
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   DARK MODE (opcional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Descomente para ativar modo escuro automático */
    /*
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        color: #e4e4e4;
    }

    .card {
        background: #2a2a3e;
        color: #e4e4e4;
    }

    input,
    select,
    textarea {
        background-color: #3a3a4e;
        color: #e4e4e4;
        border-color: #4a4a5e;
    }

    input:focus,
    select:focus,
    textarea:focus {
        background-color: #4a4a5e;
    }
    */
}