/* =====================================================
   Reset e base
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1f2937;
    background: #f3f4f6;
    -webkit-font-smoothing: antialiased;
}
input, button, select, textarea {
    font-family: inherit;
}
img { max-width: 100%; height: auto; display: block; }
a { color: #1e40af; text-decoration: none; }
a:hover { text-decoration: underline; }

/* =====================================================
   Topbar e menu
   ===================================================== */
.topbar {
    background: #1e40af;
    color: #fff;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.brand {
    color: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}
.brand-logo {
    height: 42px;
    width: 42px;
    flex-shrink: 0;
}
.brand-title { font-weight: 700; font-size: 1rem; line-height: 1.1; }
.brand-sub { font-size: 0.8rem; opacity: 0.85; }
.menu-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    font-size: 1.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    display: block;
}
.menu {
    display: none;
    width: 100%;
    flex-direction: column;
    margin-top: 0.75rem;
    gap: 0.5rem;
}
.menu.open { display: flex; }
.menu a {
    color: #fff;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.menu-user {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    opacity: 0.9;
}
.menu-user small { display: block; opacity: 0.7; }
.menu-logout { font-weight: 500; }

@media (min-width: 720px) {
    .menu-btn { display: none; }
    .menu { display: flex; flex-direction: row; width: auto; align-items: center; margin: 0; gap: 1.25rem; }
    .menu a { border: none; padding: 0; }
}

/* =====================================================
   Main e footer
   ===================================================== */
.main {
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}
.footer {
    text-align: center;
    padding: 1.5rem 1rem;
    color: #6b7280;
    font-size: 0.85rem;
}

/* =====================================================
   Headings
   ===================================================== */
h1 { font-size: 1.5rem; margin: 0 0 1rem; font-weight: 600; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; font-weight: 600; }
.muted { color: #6b7280; font-size: 0.9rem; }
.vazio { color: #6b7280; font-style: italic; padding: 1rem 0; }

/* =====================================================
   Flash messages
   ===================================================== */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border: 1px solid;
}
.flash-ok   { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.flash-erro { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.card-alerta {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
}

/* =====================================================
   Acoes rapidas (grid de botoes grandes)
   ===================================================== */
.acoes-rapidas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 1rem 0 2rem;
}
.card-acao {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem 1rem;
    text-decoration: none;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: transform 0.1s, box-shadow 0.1s;
}
.card-acao:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    text-decoration: none;
}
.card-acao h3 { color: #1e40af; }

/* =====================================================
   Botoes
   ===================================================== */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: #1e40af; color: #fff; }
.btn-primary:hover { background: #1e3a8a; color: #fff; }
.btn-secondary { background: #e5e7eb; color: #1f2937; }
.btn-danger { background: #dc2626; color: #fff; }

/* =====================================================
   Cards de viagem
   ===================================================== */
.lista-cards { display: flex; flex-direction: column; gap: 0.75rem; }
.card-viagem {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.card-viagem-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.card-acoes {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* =====================================================
   Badges (status)
   ===================================================== */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}
.badge-pendente   { background: #fef3c7; color: #92400e; }
.badge-aprovada   { background: #d1fae5; color: #065f46; }
.badge-negada     { background: #fee2e2; color: #991b1b; }
.badge-cancelada  { background: #e5e7eb; color: #4b5563; }
.badge-concluida  { background: #dbeafe; color: #1e40af; }

/* =====================================================
   Lista simples
   ===================================================== */
.lista-simples { list-style: none; padding: 0; margin: 0; }
.lista-simples li { border-bottom: 1px solid #e5e7eb; }
.lista-simples li:last-child { border-bottom: none; }
.lista-simples a {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    color: #1f2937;
}

/* =====================================================
   Formularios
   ===================================================== */
.form-grupo { margin-bottom: 1rem; }
.form-grupo label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
}
.form-grupo input,
.form-grupo select,
.form-grupo textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
}
.form-grupo input:focus,
.form-grupo select:focus,
.form-grupo textarea:focus {
    outline: 2px solid #1e40af;
    outline-offset: -1px;
    border-color: #1e40af;
}
.form-grupo .ajuda {
    display: block;
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
.form-grupo-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* =====================================================
   Tela de login
   ===================================================== */
.login-container {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.login-logo {
    width: 160px;
    height: 160px;
    margin: 0 auto 1rem;
    display: block;
}
.login-sub { color: #6b7280; margin-top: -0.5rem; margin-bottom: 1.5rem; }
.login-info { margin: 1.5rem 0; }
.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    color: #1f2937;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.1s;
}
.btn-google:hover {
    background: #f9fafb;
    text-decoration: none;
}
.login-help {
    margin-top: 2rem;
    color: #6b7280;
    font-size: 0.85rem;
}

/* =====================================================
   Avatar
   ===================================================== */
.avatar {
    display: inline-block;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    background: #e5e7eb;
    flex-shrink: 0;
}
.avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1e40af;
    color: #fff;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}
.avatar-28 { width: 28px; height: 28px; font-size: .72rem; }
.avatar-36 { width: 36px; height: 36px; font-size: .85rem; }
.avatar-40 { width: 40px; height: 40px; font-size: .9rem; }
.avatar-56 { width: 56px; height: 56px; font-size: 1.15rem; }

.ola-usuario {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 0.75rem;
}
.ola-usuario h1 { margin: 0; }

.menu-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.menu-user-text { display: flex; flex-direction: column; line-height: 1.2; }
.menu-user-text small { opacity: .75; font-size: .75rem; }

/* =====================================================
   Secoes
   ===================================================== */
.secao { margin: 2rem 0; }

/* =====================================================
   Condutor (cadastro / status)
   ===================================================== */
.condutor-status, .cond-cadastro { max-width: 640px; margin: 0 auto; }
.cond-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    margin: 16px 0;
}
.cond-card h2 { margin: 0 0 12px; font-size: 1.15rem; }
.cond-card-ok   { border-left: 4px solid #16a34a; }
.cond-card-warn { border-left: 4px solid #d97706; }
.cond-card-erro { border-left: 4px solid #dc2626; }
.cond-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.cond-card dt { color: #6b7280; font-size: .85rem; }
.cond-card dd { margin: 0; font-weight: 600; }
.cond-hint { color: #6b7280; font-size: .9rem; }

.btn-cond {
    display: inline-block;
    padding: 12px 20px;
    border-radius: 8px;
    background: #e5e7eb;
    color: #1f2937;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
}
.btn-cond-primary { background: #1e40af; color: #fff; }
.btn-cond-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-cond-primary:not(:disabled):hover { background: #1d4ed8; }

.cond-form fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    margin: 16px 0;
    background: #fff;
}
.cond-form legend { padding: 0 8px; font-weight: 600; color: #1e40af; }
.cond-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 10px 0;
    font-size: .9rem;
    color: #374151;
    font-weight: 500;
}
.cond-form input[type=text],
.cond-form input[type=date],
.cond-form select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}
.cond-form input[type=file] {
    position: absolute;
    width: 1px; height: 1px; opacity: 0;
}
.cond-upload {
    position: relative;
    display: block;
}
.cond-upload-btn {
    display: block;
    padding: 14px 16px;
    background: #eff6ff;
    border: 1.5px dashed #1e40af;
    border-radius: 8px;
    color: #1e40af;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
}
.cond-preview {
    display: block;
    width: 100%;
    margin-top: 12px;
    max-height: 280px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.cond-termo {
    background: #f9fafb;
    border-radius: 6px;
    padding: 12px;
    font-size: .9rem;
    max-height: 180px;
    overflow-y: auto;
    color: #374151;
}
.cond-checkbox {
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
    margin-top: 12px;
    line-height: 1.4;
}
.cond-checkbox input { margin-top: 3px; }
.cond-actions {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: 20px;
}

.gps-status {
    padding: 10px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: .9rem;
    color: #374151;
}
.gps-status-ok   { background: #dcfce7; color: #166534; }
.gps-status-erro { background: #fee2e2; color: #991b1b; }

.passageiros-lista {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px;
    background: #f9fafb;
}
.passageiro-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500 !important;
}
.passageiro-item:hover { background: #eff6ff; }
.passageiro-item input[type=checkbox] { margin: 0; flex-shrink: 0; }
.passageiro-item span { display: flex; flex-direction: column; line-height: 1.25; }
.passageiro-item small { color: #6b7280; font-weight: 400; font-size: .75rem; }

.terceiro-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: #fef3c7;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid #d97706;
}
.terceiro-item input,
.terceiro-item textarea {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: .95rem;
    font-family: inherit;
}
.terceiro-item .btn-remove-terceiro {
    align-self: flex-end;
    background: transparent;
    color: #991b1b;
    padding: 4px 8px;
    font-size: .85rem;
}

/* =====================================================
   Responsivo - ajustes mobile
   ===================================================== */
@media (max-width: 480px) {
    .acoes-rapidas { grid-template-columns: 1fr; }
    .form-grupo-2 { grid-template-columns: 1fr; }
    h1 { font-size: 1.3rem; }
    .main { margin-top: 1rem; }
}
