/* ============================================================
   AutoGest — Folha de Estilos Principal
   Design: Material-inspired, sidebar fixa, paleta azul/branco
   ============================================================ */

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { font-family: 'Roboto', 'Google Sans', system-ui, sans-serif; background: #f1f3f4; color: #202124; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
code { font-family: 'Roboto Mono', monospace; background: #f1f3f4; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ─── Layout principal ─────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: 240px; min-height: 100vh; background: #1a73e8;
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; transition: transform .25s cubic-bezier(.23,1,.32,1);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.15);
}
.logo-icon {
  width: 40px; height: 40px; background: rgba(255,255,255,.2); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-name { display: block; color: #fff; font-weight: 600; font-size: 15px; line-height: 1.2; }
.logo-version { display: block; color: rgba(255,255,255,.6); font-size: 11px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 8px; color: rgba(255,255,255,.85); font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.15); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.25); color: #fff; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.15);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.25);
  color: #fff; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { display: block; color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 11px; }
.role-admin   { color: #ffd666; }
.role-visitor { color: rgba(255,255,255,.6); }
.btn-logout { color: rgba(255,255,255,.7); padding: 6px; border-radius: 6px; transition: background .15s; }
.btn-logout:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ─── Main content ─────────────────────────────────────────── */
.main-content { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ─── Topbar (mobile) ──────────────────────────────────────── */
.topbar {
  display: none; align-items: center; gap: 12px; padding: 12px 16px;
  background: #fff; border-bottom: 1px solid #e8eaed; position: sticky; top: 0; z-index: 50;
}
.btn-menu-toggle { color: #5f6368; padding: 4px; }
.topbar-title { font-weight: 500; font-size: 15px; color: #202124; }

/* ─── Page content ─────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

/* ─── Page header ──────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-header-left { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 22px; font-weight: 500; color: #202124; }
.page-desc { font-size: 13px; color: #5f6368; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 6px; font-size: 13.5px; font-weight: 500; transition: all .16s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-outline { border: 1px solid #dadce0; color: #3c4043; background: #fff; }
.btn-outline:hover { background: #f8f9fa; border-color: #bdc1c6; }
.btn-ghost { color: #5f6368; }
.btn-ghost:hover { background: #f1f3f4; }
.btn-danger { background: #ea4335; color: #fff; }
.btn-danger:hover { background: #c5221f; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Forms ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 12.5px; font-weight: 500; color: #3c4043; }
.form-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.form-checkbox input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.form-input {
  padding: 8px 12px; border: 1px solid #dadce0; border-radius: 6px; font-size: 13.5px;
  color: #202124; background: #fff; transition: border-color .15s, box-shadow .15s; width: 100%;
}
.form-input:focus { outline: none; border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,.2); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-col-2 { grid-column: span 2; }

/* ─── Form Tabs ────────────────────────────────────────────── */
.form-tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.form-tab { padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; color: #5f6368; transition: all .15s; }
.form-tab:hover { background: #f1f3f4; }
.form-tab.active { background: #e8f0fe; color: #1a73e8; }
.form-tab-content { display: none; }
.form-tab-content.active { display: block; }

/* ─── Cards ────────────────────────────────────────────────── */
.section-card { background: #fff; border-radius: 12px; border: 1px solid #e8eaed; padding: 20px; margin-bottom: 16px; }
.section-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 15px; font-weight: 500; color: #202124; margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }

/* ─── Stats Grid ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: 12px; border: 1px solid #e8eaed;
  padding: 18px; display: flex; align-items: center; gap: 14px;
}
.stat-card.loading-placeholder { min-height: 80px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-blue  .stat-icon { background: #e8f0fe; color: #1a73e8; }
.stat-green .stat-icon { background: #e6f4ea; color: #137333; }
.stat-red   .stat-icon { background: #fce8e6; color: #c5221f; }
.stat-orange .stat-icon { background: #fef7e0; color: #b06000; }
.stat-yellow .stat-icon { background: #fff8e1; color: #b06000; }
.stat-value { display: block; font-size: 24px; font-weight: 600; color: #202124; line-height: 1.2; }
.stat-label { display: block; font-size: 12px; color: #5f6368; margin-top: 2px; }

/* ─── Section Row ──────────────────────────────────────────── */
.section-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ─── Alert List ───────────────────────────────────────────── */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 8px; background: #f8f9fa; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.alert-dot.red    { background: #ea4335; }
.alert-dot.orange { background: #fa7b17; }
.alert-info { display: flex; flex-direction: column; gap: 2px; }
.alert-desc { font-size: 13px; font-weight: 500; color: #202124; }
.alert-meta { font-size: 12px; color: #5f6368; }

/* ─── Vehicle Grid ─────────────────────────────────────────── */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.vehicle-card { background: #fff; border-radius: 12px; border: 1px solid #e8eaed; overflow: hidden; transition: box-shadow .2s, transform .2s; display: block; }
.vehicle-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); }
.vehicle-card-img { height: 140px; background: #f8f9fa; position: relative; overflow: hidden; }
.vehicle-card-img img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-no-photo { height: 100%; display: flex; align-items: center; justify-content: center; }
.vehicle-no-photo-lg { height: 100%; display: flex; align-items: center; justify-content: center; background: #f8f9fa; }
.vehicle-card-body { padding: 12px; }
.vehicle-plate { font-size: 16px; font-weight: 700; color: #202124; letter-spacing: 1px; }
.vehicle-model { font-size: 12px; color: #5f6368; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vehicle-owner { font-size: 12px; color: #80868b; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vehicle-value { font-size: 12px; color: #137333; font-weight: 500; margin-top: 4px; }

/* ─── Badges ───────────────────────────────────────────────── */
.vehicle-badge { position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 12px; font-size: 11.5px; font-weight: 500; }
.badge-active, .badge-green { background: #e6f4ea; color: #137333; }
.badge-sold   { background: #e8f0fe; color: #1a73e8; }
.badge-inactive { background: #f1f3f4; color: #5f6368; }
.badge-red    { background: #fce8e6; color: #c5221f; }
.badge-orange { background: #fef7e0; color: #b06000; }
.badge-blue   { background: #e8f0fe; color: #1a73e8; }
.badge-gray   { background: #f1f3f4; color: #5f6368; }
.badge-plate  { font-size: 18px; font-weight: 700; letter-spacing: 1.5px; color: #202124; }

/* ─── Vehicle Hero ─────────────────────────────────────────── */
.vehicle-hero { display: grid; grid-template-columns: 320px 1fr; gap: 24px; margin-bottom: 24px; background: #fff; border-radius: 12px; border: 1px solid #e8eaed; overflow: hidden; }
.vehicle-hero-img { height: 240px; background: #f8f9fa; overflow: hidden; }
.vehicle-hero-img img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-hero-info { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; align-items: center; gap: 8px; }
.info-label { font-size: 12px; color: #5f6368; min-width: 100px; flex-shrink: 0; }
.info-value { font-size: 13.5px; color: #202124; font-weight: 500; }
.info-list { display: flex; flex-direction: column; gap: 10px; }
.text-green { color: #137333; }
.text-muted { color: #5f6368; font-size: 13px; }

/* ─── Module Tabs ──────────────────────────────────────────── */
.module-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; border-bottom: 1px solid #e8eaed; padding-bottom: 8px; }
.module-tab { padding: 8px 16px; border-radius: 8px 8px 0 0; font-size: 13.5px; font-weight: 500; color: #5f6368; transition: all .15s; }
.module-tab:hover { background: #f1f3f4; color: #202124; }
.module-tab.active { background: #e8f0fe; color: #1a73e8; }
.module-content { background: #fff; border-radius: 12px; border: 1px solid #e8eaed; padding: 20px; }
.module-header { display: flex; justify-content: flex-end; margin-bottom: 16px; }

/* ─── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 12px; background: #f8f9fa; color: #5f6368; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid #e8eaed; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f1f3f4; color: #202124; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8f9fa; }
.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── Documents ────────────────────────────────────────────── */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; border: 1px solid #e8eaed; background: #fafafa; }
.doc-icon { font-size: 24px; flex-shrink: 0; }
.doc-info { flex: 1; min-width: 0; }
.doc-title { display: block; font-size: 13.5px; font-weight: 500; color: #202124; }
.doc-meta  { display: block; font-size: 12px; color: #5f6368; margin-top: 2px; }
.doc-actions { display: flex; gap: 6px; }

/* ─── Gallery ──────────────────────────────────────────────── */
.gallery-card { margin-bottom: 20px; }
.gallery-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo-item { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #f1f3f4; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; transition: transform .2s; }
.photo-item img:hover { transform: scale(1.05); }
.photo-delete { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; width: 22px; height: 22px; font-size: 14px; display: flex; align-items: center; justify-content: center; }

/* ─── Financing ────────────────────────────────────────────── */
.financing-card { margin-bottom: 20px; border: 1px solid #e8eaed; border-radius: 10px; overflow: hidden; }
.financing-header { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: #f8f9fa; font-size: 13.5px; flex-wrap: wrap; }

/* ─── Search bar ───────────────────────────────────────────── */
.search-bar-card { background: #fff; border-radius: 12px; border: 1px solid #e8eaed; padding: 16px; margin-bottom: 16px; }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #5f6368; pointer-events: none; }
.search-input { padding-left: 34px; }
.search-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

/* ─── Reports ──────────────────────────────────────────────── */
.report-stats { display: flex; gap: 20px; padding: 12px 0; margin-bottom: 12px; font-size: 13.5px; font-weight: 500; color: #202124; flex-wrap: wrap; }

/* ─── Settings ─────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Help ─────────────────────────────────────────────────── */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.help-grid .section-card p { font-size: 13.5px; color: #3c4043; line-height: 1.6; margin-bottom: 8px; }

/* ─── Modal ────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 480px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,.2); animation: modalIn .2s cubic-bezier(.23,1,.32,1); }
.modal-lg { max-width: 720px; }
@keyframes modalIn { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-header h3 { font-size: 16px; font-weight: 500; color: #202124; }
.modal-close { font-size: 22px; color: #5f6368; padding: 4px 8px; border-radius: 6px; transition: background .15s; }
.modal-close:hover { background: #f1f3f4; }
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #e8eaed; }

/* ─── Detail Grid (modal visualização) ─────────────────────── */
.detail-grid { display: flex; flex-direction: column; gap: 0; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #e8eaed; }
.detail-row:last-child { border-bottom: none; }
.detail-row strong { font-weight: 500; color: #5f6368; font-size: 13px; }
.detail-row span { text-align: right; font-size: 14px; color: #202124; }

/* ─── Alerts ───────────────────────────────────────────────── */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 12px; }
.alert-success { background: #e6f4ea; color: #137333; border: 1px solid #ceead6; }
.alert-error   { background: #fce8e6; color: #c5221f; border: 1px solid #f5c6c2; }
.alert-info    { background: #e8f0fe; color: #1a73e8; border: 1px solid #c5d8fb; }

/* ─── Login page ───────────────────────────────────────────── */
.login-body { background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-container { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { width: 64px; height: 64px; background: rgba(255,255,255,.2); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.login-title { font-size: 28px; font-weight: 600; color: #fff; }
.login-subtitle { font-size: 14px; color: rgba(255,255,255,.7); margin-top: 4px; }
.login-card { background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.login-footer { text-align: center; color: rgba(255,255,255,.6); font-size: 12px; margin-top: 16px; }
.setup-banner { display: flex; gap: 12px; padding: 12px 14px; background: #e8f0fe; border-radius: 8px; margin-bottom: 16px; font-size: 13px; color: #1a73e8; }
.setup-banner strong { display: block; margin-bottom: 2px; }
.setup-banner p { margin: 0; color: #3c4043; }
.divider { text-align: center; position: relative; margin: 16px 0; color: #80868b; font-size: 12px; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; width: calc(50% - 30px); height: 1px; background: #e8eaed; }
.divider::before { left: 0; } .divider::after { right: 0; }
.input-password-wrap { position: relative; }
.btn-eye { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #5f6368; padding: 4px; }

/* ─── Spinner ──────────────────────────────────────────────── */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty state ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: #5f6368; }
.empty-state p { margin-bottom: 16px; font-size: 14px; }
.empty-state-sm { padding: 20px; text-align: center; color: #80868b; font-size: 13px; }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { display: flex; }
  .vehicle-hero { grid-template-columns: 1fr; }
  .vehicle-hero-img { height: 200px; }
  .section-row { grid-template-columns: 1fr; }
  .settings-grid, .help-grid { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .form-col-2 { grid-column: span 1; }
}
@media (max-width: 600px) {
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .vehicle-grid { grid-template-columns: 1fr 1fr; }
}
