/* ========================================
   SCAMBIOAUTO DASHBOARD STYLES
   ======================================== */

/* CSS Variables - Theme Tokens */
:root {
  --background: #f7f6f2;
  --foreground: #24231f;
  --border: #d7d2c9;
  --input: #fbfbf8;
  --primary: #0c6b6f;
  --primary-foreground: #ffffff;
  --secondary: #eeeae3;
  --secondary-foreground: #24231f;
  --muted: #eeeae3;
  --muted-foreground: #6f6d68;
  --success: #3f7a3a;
  --success-foreground: #ffffff;
  --accent: #d1ab49;
  --accent-foreground: #ffffff;
  --destructive: #a24444;
  --destructive-foreground: #ffffff;
  --warning: #b28a3d;
  --warning-foreground: #24231f;
  --card: #fbfbf8;
  --card-foreground: #24231f;
  --sidebar: #fbfbf8;
  --sidebar-foreground: #24231f;
  --sidebar-primary: #0c6b6f;
  --sidebar-primary-foreground: #ffffff;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
}

/* ========================================
   LAYOUT
   ======================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--background);
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
  width: 260px;
  background-color: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 100vh;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
}

.sidebar-logo {
  height: 34px;
  width: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background-color: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon-svg {
  width: 20px;
  height: 20px;
  color: var(--primary-foreground);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  font-weight: 600;
  padding: 0 12px 8px;
  white-space: nowrap;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  color: var(--sidebar-foreground);
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.nav-item:hover {
  background-color: var(--muted);
  color: var(--foreground);
}

.nav-item.active {
  background-color: var(--sidebar-primary);
  color: var(--sidebar-primary-foreground);
}

.icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.nav-icon {
  width: 18px;
  height: 18px;
  color: inherit;
}

.nav-badge {
  margin-left: auto;
  background-color: var(--accent);
  color: var(--accent-foreground);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
}

/* ========================================
   DEALER/USER PROFILE
   ======================================== */

.dealer-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: transparent;
}

.dealer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
}

.dealer-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background-color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-icon {
  width: 24px;
  height: 24px;
  color: var(--muted-foreground);
}

.dealer-info {
  display: flex;
  flex-direction: column;
}

.dealer-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.dealer-role {
  font-size: 13px;
  color: var(--muted-foreground);
}

/* User Profile Container with Logout */
.user-profile-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logout-form {
  margin: 0;
  padding: 0;
}

.logout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-md);
  background-color: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  color: var(--muted-foreground);
}

.logout-button:hover {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

.logout-icon {
  width: 18px;
  height: 18px;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 40px 48px;
}

.content-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ========================================
   PAGE HEADER
   ======================================== */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 15px;
  color: var(--muted-foreground);
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 4px 12px rgba(12, 107, 111, 0.14);
}

.btn-primary:hover {
  background-color: #095759;
}

.btn-outline {
  background-color: var(--card);
  border-color: var(--border);
  color: var(--foreground);
}

.btn-outline:hover {
  background-color: var(--muted);
}

.btn-ghost {
  background-color: transparent;
  color: var(--muted-foreground);
}

.btn-ghost:hover {
  background-color: var(--muted);
  color: var(--foreground);
}

.btn-icon {
  width: 16px;
  height: 16px;
  color: inherit;
}

/* ========================================
   VEHICLE PROFILE CARD
   ======================================== */

.vehicle-profile-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 22px rgba(36, 35, 31, 0.05);
  display: flex;
  overflow: hidden;
}

.vpc-section {
  flex: 1;
  padding: 24px 32px;
}

.vpc-section-preferences {
  background-color: var(--secondary);
}

.vpc-divider {
  width: 1px;
  background-color: var(--border);
}

.vpc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.vpc-header-icon {
  width: 20px;
  height: 20px;
  color: var(--muted-foreground);
}

.vpc-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
}

.vpc-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.vpc-badge.badge-active {
  background-color: var(--success);
  color: var(--success-foreground);
}

.vpc-badge.badge-draft {
  background-color: var(--warning);
  color: var(--warning-foreground);
}

.vpc-badge.badge-suspended {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

.vpc-badge.badge-default {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.vpc-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vpc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.vpc-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.vpc-label {
  font-size: 14px;
  color: var(--muted-foreground);
}

.vpc-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  text-align: right;
}

.vpc-value-highlight {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.vpc-value-success {
  color: var(--success);
}

.vpc-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tag {
  display: inline-flex;
  align-items: center;
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* ========================================
   TABS
   ======================================== */

.tabs-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tabs-header {
  display: flex;
  align-items: center;
  gap: 32px;
  border-bottom: 1px solid var(--border);
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-foreground);
  position: relative;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tab:hover {
  color: var(--foreground);
}

.tab.active {
  color: var(--foreground);
}

.tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent);
}

.tab-badge {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
}

.tab.active .tab-badge {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.tab-content {
  min-height: 200px;
}

/* ========================================
   MATCHES GRID & CARDS
   ======================================== */

.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.match-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(36, 35, 31, 0.06);
  display: flex;
  flex-direction: column;
}

.match-image-container {
  position: relative;
  height: 160px;
  width: 100%;
  background-color: var(--muted);
}

.match-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(8px) brightness(0.6);
}

.match-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--muted);
}

.match-placeholder-icon {
  width: 64px;
  height: 64px;
  color: var(--muted-foreground);
  opacity: 0.4;
}

.match-compatibility {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: rgba(251, 251, 248, 0.95);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(36, 35, 31, 0.08);
}

.compatibility-icon {
  width: 14px;
  height: 14px;
}

.compatibility-high {
  color: var(--success);
}

.compatibility-medium {
  color: var(--warning);
}

.compatibility-low {
  color: var(--destructive);
}

.match-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(
    to top,
    rgba(36, 35, 31, 0.78),
    rgba(36, 35, 31, 0)
  );
  color: #ffffff;
}

.match-overlay-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.overlay-icon {
  width: 16px;
  height: 16px;
}

.match-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.match-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.spec-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.spec-label {
  font-size: 12px;
  color: var(--muted-foreground);
}

.spec-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.spec-icon {
  width: 14px;
  height: 14px;
  color: var(--muted-foreground);
}

.match-divider {
  height: 1px;
  background-color: var(--border);
  margin: 4px 0;
}

.match-valuation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.match-valuation-label {
  font-size: 13px;
  color: var(--muted-foreground);
}

.match-valuation-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--foreground);
  text-align: right;
}

.match-actions {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background-color: var(--secondary);
}

.match-actions .btn {
  flex: 1;
}

.anon-notice {
  font-size: 11px;
  color: var(--muted-foreground);
  text-align: center;
  margin-top: -8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.notice-icon {
  width: 12px;
  height: 12px;
}

/* Match card buttons override */
.match-card .btn-outline {
  background: var(--card);
}

.match-card .btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
  box-shadow: none;
}

/* ========================================
   PROPOSALS
   ======================================== */

.proposals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.proposal-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 8px 22px rgba(36, 35, 31, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.proposal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.proposal-source {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.proposal-label {
  font-size: 12px;
  color: var(--muted-foreground);
}

.proposal-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.proposal-status-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
}

.proposal-status-badge.status-pending {
  background-color: var(--warning);
  color: var(--warning-foreground);
}

.proposal-status-badge.status-accepted {
  background-color: var(--success);
  color: var(--success-foreground);
}

.proposal-status-badge.status-rejected {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

.proposal-status-badge.status-default {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.proposal-vehicle {
  display: flex;
  gap: 12px;
  align-items: center;
}

.vehicle-image-placeholder {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background-color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vehicle-icon {
  width: 32px;
  height: 32px;
  color: var(--muted-foreground);
  opacity: 0.5;
}

.vehicle-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.vehicle-info p {
  font-size: 13px;
  color: var(--muted-foreground);
  margin: 0;
}

.proposal-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.check-indicator.check-green {
  background-color: rgba(63, 122, 58, 0.1);
  color: var(--success);
}

.check-indicator.check-orange {
  background-color: rgba(178, 138, 61, 0.1);
  color: var(--warning);
}

.check-indicator.check-neutral {
  background-color: var(--secondary);
  color: var(--muted-foreground);
}

.check-icon {
  width: 14px;
  height: 14px;
}

.check-label {
  font-weight: 500;
}

.proposal-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

.proposal-actions .btn {
  flex: 1;
}

/* ========================================
   CONTACTS
   ======================================== */

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.contact-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 8px 22px rgba(36, 35, 31, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.contact-avatar {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  overflow: hidden;
}

.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-avatar-placeholder {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background-color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.contact-location {
  font-size: 13px;
  color: var(--muted-foreground);
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--foreground);
}

.contact-icon {
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
}

.contact-actions {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  gap: 16px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background-color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon .icon {
  width: 32px;
  height: 32px;
  color: var(--muted-foreground);
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.empty-description {
  font-size: 14px;
  color: var(--muted-foreground);
  margin: 0;
  max-width: 400px;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 1s linear infinite;
}

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

/* ========================================
   VIEW ALL LINK
   ======================================== */

.view-all {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
  .sidebar {
    width: 72px;
  }
  
  .logo-text,
  .nav-label,
  .nav-item span,
  .dealer-info {
    display: none;
  }
  
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  
  .nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    margin: 0;
    padding: 2px 6px;
    font-size: 10px;
  }
  
  .sidebar-header {
    justify-content: center;
  }
  
  .sidebar-footer {
    display: flex;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  
  .main-content {
    padding: 24px 16px;
  }
  
  .content-container {
    max-width: 100%;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .vehicle-profile-card {
    flex-direction: column;
  }
  
  .vpc-divider {
    width: 100%;
    height: 1px;
  }
  
  .vpc-section {
    padding: 20px 24px;
  }
  
  .tabs-header {
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  
  .matches-grid,
  .proposals-grid,
  .contacts-grid {
    grid-template-columns: 1fr;
  }
  
  .match-specs {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .match-specs {
    grid-template-columns: 1fr;
  }
  
  .match-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .match-actions .btn {
    width: 100%;
  }
}
