:root {
  --bg-white: #ffffff;
  --bg-light: #f8f9fa;
  --primary-black: #1a1a1a;
  --accent-gray: #e9ecef;
  --text-main: #333333;
  --text-muted: #6c757d;
  --border-color: #dee2e6;
  --error-red: #dc3545;
  --success-green: #28a745;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

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

html,
body {
  min-height: 100%;
}

body {
  font-family: "Outfit", sans-serif;
  background-color: var(--bg-light);
  color: var(--text-main);
  line-height: 1.6;
  display: flex;
  margin: 0;
}

/* Login Styles */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background:
    linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
    url("img/login.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(10px);
  text-align: center;
}

.login-card .login-logo {
  max-width: 150px;
  margin-bottom: 20px;
}

.login-box {
  background: var(--bg-white);
  padding: 40px;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  text-align: center;
}

.login-box h1 {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--primary-black);
  margin-bottom: 5px;
}

.login-box p {
  color: var(--text-muted);
  margin-bottom: 30px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.8rem;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  transition: all 0.3s ease;
}

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

.form-group select,
.filter-form select,
.modal-content select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  background-color: white;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 15px) center;
}

/* Layout Styles */
body {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background-color: var(--primary-black);
  color: white;
  height: 100vh;
  position: fixed;
  display: flex;
  flex-direction: column;
}

.sidebar .logo {
  padding: 30px 20px;
  border-bottom: 1px solid #333;
}

.sidebar .logo h2 {
  font-size: 1.5rem;
  letter-spacing: 2px;
}

.sidebar nav {
  flex: 1;
  padding: 20px 0;
}

.sidebar nav ul {
  list-style: none;
}

.sidebar nav ul li a {
  display: block;
  padding: 12px 25px;
  color: #ccc;
  text-decoration: none;
  transition: all 0.3s;
}

.sidebar nav ul li a i {
  margin-right: 12px;
  width: 20px;
  text-align: center;
}

.sidebar nav ul li a:hover {
  color: white;
  background-color: #333;
}

.nav-divider {
  padding: 20px 25px 10px;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 1px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid #333;
}

.user-info {
  display: block;
  color: white;
  text-decoration: none;
  margin-bottom: 10px;
  font-weight: 500;
}

.logout-link {
  color: var(--error-red);
  text-decoration: none;
  font-size: 0.9rem;
}

.content {
  flex: 1;
  margin-left: 250px;
  background-color: var(--bg-light);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: visible;
}

.main-footer {
  margin-top: auto;
  padding: 10px 40px;
  border-top: 1px solid var(--border-color);
  text-align: right;
  color: var(--text-muted);
  font-size: 0.8rem;
  background: white;
  width: 100%;
}

.main-footer a {
  color: var(--primary-black);
  font-weight: 600;
  text-decoration: none;
}

.top-header {
  background-color: white;
  padding: 15px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.top-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

.quick-search input {
  padding: 8px 20px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 300px;
  font-size: 0.9rem;
}

.main-body {
  padding: 40px;
  flex: 1;
  overflow: visible;
}

/* Dashboard Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}

.stat-card h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary-black);
}

/* Section Components */
.section-card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: 30px;
}

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

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

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

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.sidebar .logo {
  padding: 2.5rem 2.5rem 2rem;
  text-align: center;
}

.sidebar .logo img {
  max-width: 100%;
  height: auto;
  filter: brightness(0) invert(1); /* Logo em branco para o fundo preto */
}

.data-table th,
.data-table td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

/* Centering utility for color/badge containers */
.center-content {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center; /* Centered on desktop */
}

.badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.btn-small {
  padding: 8px 15px;
  background: var(--accent-gray);
  color: var(--primary-black);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--primary-black);
  color: white;
}

/* Split Layout */
.split-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 30px;
  align-items: start;
}

.btn-primary {
  padding: 12px 25px;
  background: var(--primary-black);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-secondary {
  padding: 12px 25px;
  background: var(--accent-gray);
  color: var(--text-main);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger {
  color: var(--error-red) !important;
}

.btn-danger:hover {
  background: var(--error-red) !important;
  color: white !important;
}

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

.badge-admin {
  background: #000;
  color: #fff;
}

/* Vehicle Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-grid textarea {
  width: 100%;
  height: 100px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  resize: none;
}

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

/* Veículos Page Layout */
.veiculos-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
}

.location-panel {
    position: sticky;
    top: 20px;
}

.location-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text-main);
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.location-item:hover {
    background: var(--accent-gray);
}

.location-item.active {
    background: var(--primary-black);
    color: white;
}

.location-item .loc-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.location-item.active .loc-color {
    border-color: rgba(255,255,255,0.3);
}

.location-item .loc-name {
    flex: 1;
    font-weight: 500;
}

.location-item .loc-count {
    background: rgba(0,0,0,0.06);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
}

.location-item.active .loc-count {
    background: rgba(255,255,255,0.15);
    color: white;
}

.filter-form {
  display: flex;
  gap: 15px;
}

.filter-form input,
.filter-form select {
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  height: 45px; /* Ensure uniform height for filters */
}

.filter-form select {
  min-width: 200px;
}

.action-buttons {
  display: flex;
  gap: 5px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 12px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin-bottom: 25px;
}

.modal-content select,
.modal-content input {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

/* Detalhes Page */
.veiculo-detalhes-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 30px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 20px;
}

.info-item label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
}

.work-sheet {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.work-item p {
  background: #fdfdfd;
  padding: 15px;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-top: 5px;
  font-size: 0.9rem;
  color: #444;
}

/* Timeline */
.timeline {
  margin-top: 20px;
  position: relative;
  padding-left: 20px;
  border-left: 2px solid var(--accent-gray);
}

.timeline-item {
  margin-bottom: 25px;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 5px;
  width: 12px;
  height: 12px;
  background: var(--primary-black);
  border-radius: 50%;
}

.timeline-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.timeline-content strong {
  display: block;
  font-size: 1rem;
}

.timeline-content small {
  color: var(--text-muted);
}

.btn-login {
  width: 100%;
  padding: 14px;
  background-color: var(--primary-black);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease;
}

.btn-login:hover {
  background-color: #000;
  transform: translateY(-2px);
}

.alert {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

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

/* Responsive Utilities */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 10px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
}

.sidebar-overlay.active {
  display: block;
}

.sidebar .close-sidebar {
  display: none;
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Media Queries */
@media (max-width: 1024px) {
  .sidebar {
    width: 200px;
  }
  .content {
    margin-left: 200px;
  }
  .split-layout {
    grid-template-columns: 350px 1fr;
  }
  .veiculos-layout {
    grid-template-columns: 1fr 240px;
  }
  .veiculo-detalhes-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 2000;
    width: 250px;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
  }

  .mobile-toggle {
    display: block;
  }

  .top-header {
    padding: 10px 20px;
  }

  .quick-search {
    display: none; /* Hide on small screens to save space */
  }

  .sidebar .close-sidebar {
    display: block;
  }

  .main-body {
    padding: 15px;
  }

  /* Transform Table into Cards for better mobile view */
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table th,
  .data-table td,
  .data-table tr {
    display: block;
  }

  .data-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .data-table tr {
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
    border-radius: 8px;
    background: white;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  }

  .data-table td {
    border: none;
    padding-left: 50%;
    position: relative;
    padding-top: 10px;
    padding-bottom: 10px;
    min-height: 40px;
    text-align: right;
  }

  .data-table td:before {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  .center-content {
    justify-content: flex-end;
  }

  /* Specific adjustments for actions on mobile */
  .action-buttons {
    justify-content: flex-end;
    margin-top: 10px;
    border-top: 1px solid var(--accent-gray);
    padding-top: 10px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .split-layout {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .veiculo-detalhes-grid {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .data-table-container {
    overflow-x: auto;
  }

  .modal-content {
    width: 90%;
    padding: 20px;
  }

  .list-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
    width: 100%;
  }

  .filters {
    width: 100%;
  }

  .filter-form {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .filter-form input,
  .filter-form select,
  .filter-form button,
  .filter-form .btn-secondary {
    width: 100%;
    margin: 0;
    text-align: center;
  }

  .list-header .btn-primary {
    width: 100%;
    text-align: center;
  }

  .veiculos-layout {
    grid-template-columns: 1fr;
  }

  .location-panel {
    position: static;
    order: -1;
  }

  .location-panel .section-card {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .location-panel .section-card h3 {
    width: 100%;
    margin-bottom: 5px !important;
  }

  .location-panel .location-item {
    padding: 6px 12px;
    font-size: 0.8rem;
    margin-bottom: 0;
  }
}

/* Table Wrapper for horizontal scroll on mobile */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
