/* ==========================================================================
   SPEEDWAYS GARAGE - PREMIUM ADMIN DASHBOARD STYLES
   ========================================================================== */

:root {
  --bg-main: #0c0d10;
  --bg-sidebar: #13151a;
  --bg-card: #181b22;
  --bg-card-hover: #1e222b;
  --bg-input: #111317;
  --border-color: #262a34;
  --border-focus: #e62e2d;

  --accent-red: #e62e2d;
  --accent-red-hover: #ff3e3d;
  --accent-glow: rgba(230, 46, 45, 0.25);

  --accent-whatsapp: #25d366;
  --accent-whatsapp-hover: #22bf5b;
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --accent-green: #10b981;

  --text-primary: #ffffff;
  --text-secondary: #9ea6b5;
  --text-muted: #656d7e;

  --font-heading: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------
   Login Page Specific
   ------------------------------------------------------------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: radial-gradient(circle at top, #1c1313 0%, var(--bg-main) 70%);
}

.login-wrapper {
  width: 100%;
  max-width: 440px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  height: 54px;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.login-brand h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 0.25rem;
}

.login-hint-box {
  margin-top: 1.75rem;
  background: rgba(230, 46, 45, 0.08);
  border: 1px solid rgba(230, 46, 45, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.85rem;
}

.hint-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-red);
  margin-bottom: 0.35rem;
}

.login-hint-box code {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  color: #fff;
  font-weight: 600;
}

.hint-note {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
}

.back-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--text-primary);
}

/* -------------------------------------------------------------
   Admin Layout & Sidebar
   ------------------------------------------------------------- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  height: 38px;
  border-radius: 6px;
}

.brand-text h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.brand-text span {
  font-size: 0.7rem;
  color: var(--accent-red);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.25rem 0.75rem;
  font-weight: 700;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
  color: #ffffff;
  background: rgba(230, 46, 45, 0.15);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 15%;
  bottom: 15%;
  width: 4px;
  background: var(--accent-red);
  border-radius: 0 4px 4px 0;
}

.sidebar-link .badge {
  margin-left: auto;
  font-size: 0.7rem;
  background: var(--accent-red);
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--border-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  line-height: 1.2;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-logout:hover {
  color: var(--accent-red);
  background: rgba(230, 46, 45, 0.1);
}

/* -------------------------------------------------------------
   Admin Main Content
   ------------------------------------------------------------- */
.admin-main {
  flex: 1;
  margin-left: 260px;
  padding: 2rem;
  max-width: 1400px;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.page-title h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.page-title p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* -------------------------------------------------------------
   Buttons
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-red);
  color: #ffffff;
  border-color: var(--accent-red);
}

.btn-primary:hover {
  background: var(--accent-red-hover);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

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

.btn-whatsapp {
  background: #1b8a43;
  color: #ffffff;
  border-color: #1b8a43;
}

.btn-whatsapp:hover {
  background: var(--accent-whatsapp);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
}

.btn-danger {
  background: rgba(230, 46, 45, 0.15);
  color: #ff5e5e;
  border-color: rgba(230, 46, 45, 0.3);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #fff;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* -------------------------------------------------------------
   Cards & Stats Grid
   ------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(230, 46, 45, 0.12);
  color: var(--accent-red);
}

.stat-icon-wrap.blue {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
}

.stat-icon-wrap.green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
}

.stat-icon-wrap.amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
}

.stat-details {
  line-height: 1.2;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* -------------------------------------------------------------
   Content Panels & Tables
   ------------------------------------------------------------- */
.content-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.filter-btn.active {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

/* Search input */
.search-box {
  position: relative;
  min-width: 240px;
}

.search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.45rem 0.85rem 0.45rem 2.2rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  outline: none;
}

.search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 15px;
  height: 15px;
}

/* Table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.admin-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.new {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-badge.contacted {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.resolved {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Actions in table */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* -------------------------------------------------------------
   Forms & Inputs
   ------------------------------------------------------------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

.input-icon-wrap .form-control {
  padding-left: 2.75rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
}

.password-toggle-btn:hover {
  color: var(--text-primary);
}

/* Form Grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.settings-section-divider {
  border-top: 1px solid var(--border-color);
  margin: 2rem 0 1.5rem 0;
  padding-top: 1.5rem;
}

.settings-section-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.settings-section-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* -------------------------------------------------------------
   Cards Management (Services / Testimonials)
   ------------------------------------------------------------- */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.item-card:hover {
  border-color: var(--border-focus);
}

.item-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.item-badge-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(230, 46, 45, 0.12);
  color: var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.item-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1;
  margin-bottom: 1rem;
}

.item-card-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #2e333d;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-red);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* -------------------------------------------------------------
   Client Handover Box
   ------------------------------------------------------------- */
.handover-card {
  background: linear-gradient(135deg, rgba(230, 46, 45, 0.12) 0%, rgba(20, 20, 25, 0.8) 100%);
  border: 1px solid rgba(230, 46, 45, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.handover-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.handover-header h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: #fff;
}

.handover-content {
  background: rgba(0, 0, 0, 0.4);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #e2e8f0;
  position: relative;
}

.copy-handover-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

/* -------------------------------------------------------------
   Modal Dialogs
   ------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* -------------------------------------------------------------
   Alerts & Toast
   ------------------------------------------------------------- */
.admin-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.admin-alert.error {
  background: rgba(230, 46, 45, 0.15);
  border: 1px solid rgba(230, 46, 45, 0.3);
  color: #ff7575;
}

.admin-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.admin-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
}

.admin-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.admin-toast.success {
  border-left: 4px solid var(--accent-green);
}

.admin-toast.error {
  border-left: 4px solid var(--accent-red);
}

/* -------------------------------------------------------------
   Responsive Breakpoints
   ------------------------------------------------------------- */
@media (max-width: 992px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
    padding: 1.25rem;
  }

  .mobile-menu-toggle {
    display: block;
  }
}
