/* ==========================================================================
   KickAssCars.com -UI Components
   ========================================================================== */

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-glow-red);
  color: #fff;
}

.btn-secondary {
  background-color: transparent;
  color: var(--secondary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--secondary);
  background-color: var(--secondary-muted);
  color: var(--text);
}

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

.btn-ghost:hover {
  background-color: var(--bg-hover);
  color: var(--text);
}

.btn-danger {
  background-color: var(--error);
  color: #fff;
  border-color: var(--error);
}

.btn-danger:hover {
  background-color: #dc2626;
  border-color: #dc2626;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.0625rem;
}

.btn-icon {
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
  padding: 4px;
  min-width: 28px;
  min-height: 28px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-body {
  padding: var(--space-lg);
}

.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-subtle);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.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 12 12' fill='%23999'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-error {
  color: var(--error);
  font-size: 0.8125rem;
  margin-top: var(--space-xs);
}

.form-hint {
  color: var(--text-subtle);
  font-size: 0.8125rem;
  margin-top: var(--space-xs);
}

/* ── Modal ──────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: var(--z-modal);
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform var(--transition-base);
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: color var(--transition-base), background-color var(--transition-base);
}

.modal-close:hover {
  color: var(--text);
  background-color: var(--bg-hover);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}

/* ── Badges ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.badge-red {
  background-color: var(--primary-muted);
  color: var(--primary);
}

.badge-blue {
  background-color: var(--accent-muted);
  color: var(--accent);
}

.badge-green {
  background-color: var(--success-muted);
  color: var(--success);
}

.badge-gray {
  background-color: var(--secondary-muted);
  color: var(--text-muted);
}

.badge-warning {
  background-color: var(--warning-muted);
  color: var(--warning);
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  position: relative;
  padding: var(--space-md) var(--space-lg);
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: none;
  background: none;
  cursor: pointer;
  transition: color var(--transition-base);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

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

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.9375rem;
  line-height: var(--leading-normal);
}

.alert-success {
  background-color: var(--success-muted);
  border-color: var(--success);
  color: var(--success);
}

.alert-warning {
  background-color: var(--warning-muted);
  border-color: var(--warning);
  color: var(--warning);
}

.alert-error {
  background-color: var(--error-muted);
  border-color: var(--error);
  color: var(--error);
}

.alert-info {
  background-color: var(--info-muted);
  border-color: var(--info);
  color: var(--info);
}

/* ── Tags ───────────────────────────────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.tag:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.tag-removable {
  cursor: pointer;
}

.tag-removable .tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 0.625rem;
  border-radius: 50%;
  background-color: var(--border-strong);
  color: var(--text);
  transition: background-color var(--transition-base);
}

.tag-removable .tag-remove:hover {
  background-color: var(--error);
}

/* ── Dropdown ───────────────────────────────────────────────────────────── */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-xs);
  min-width: 180px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition-base);
  padding: var(--space-xs) 0;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.dropdown-item:hover {
  background-color: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border);
  margin: var(--space-xs) 0;
}

/* ── Avatar ─────────────────────────────────────────────────────────────── */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-sm {
  width: 24px;
  height: 24px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
}

.avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary-muted);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  flex-shrink: 0;
}

.avatar-placeholder.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 0.625rem;
}

.avatar-placeholder.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
}

/* ── Spinner ────────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

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

/* ── Toast ──────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-md));
  right: var(--space-md);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9375rem;
  color: var(--text);
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform var(--transition-slow);
  max-width: 400px;
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--error);
}

.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-info {
  border-left: 3px solid var(--accent);
}

/* ── Empty State ────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-lg);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--text-subtle);
  margin-bottom: var(--space-md);
}

.empty-state h3 {
  margin-bottom: var(--space-sm);
  color: var(--text-muted);
}

.empty-state p {
  color: var(--text-subtle);
  max-width: 400px;
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
  position: sticky;
  top: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  background-color: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-navbar);
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.nav-logo:hover {
  text-decoration: none;
}

.logo-kick {
  color: var(--text);
}

.logo-ass {
  color: var(--primary);
}

.logo-cars {
  color: var(--secondary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-link {
  padding: var(--space-sm) var(--space-md);
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color var(--transition-base), background-color var(--transition-base);
}

.nav-link:hover {
  color: var(--text);
  background-color: var(--bg-hover);
  text-decoration: none;
}

.nav-link.active {
  color: var(--primary);
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ── Hamburger (mobile) ─────────────────────────────────────────────────── */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  z-index: var(--z-navbar);
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
  transition: all var(--transition-base);
  transform-origin: center;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ── Mobile Nav ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    background-color: rgba(13, 13, 13, 0.98);
    padding: var(--space-lg);
    gap: 0;
    overflow-y: auto;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    padding: var(--space-md);
    font-size: 1.125rem;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }

  .nav-auth {
    flex-direction: column;
    margin-top: var(--space-md);
  }

  .nav-auth .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: var(--space-3xl) 0 var(--space-xl);
  margin-top: var(--space-3xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.footer-col h4 {
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.footer-col a {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: var(--space-xs) 0;
  transition: color var(--transition-base);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--primary);
  text-decoration: none;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero {
  width: 100%;
  padding: var(--space-3xl) var(--space-lg);
  background: linear-gradient(135deg, var(--bg) 0%, #1a0a0c 50%, var(--bg) 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--text) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: var(--space-xl);
}

.hero .btn {
  font-size: 1.0625rem;
  padding: 14px 32px;
}

@media (max-width: 768px) {
  .hero {
    min-height: 300px;
    padding: var(--space-2xl) var(--space-md);
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero p {
    font-size: 1rem;
  }
}

/* ==========================================================================
   Profile
   ========================================================================== */

.profile-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  padding: var(--space-xl) 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-xl);
}

.profile-info {
  flex: 1;
}

.profile-info h1 {
  font-size: 1.75rem;
  margin-bottom: var(--space-xs);
}

.profile-info p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.profile-stats {
  display: flex;
  gap: var(--space-xl);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-stats {
    justify-content: center;
  }
}
