/* Apple Business Design System - REJ Repair Management System */

:root {
  --bg-main: #f5f5f7;
  --bg-card: #ffffff;
  --bg-sidebar: #1d1d1f;
  --text-main: #1d1d1f;
  --text-muted: #86868b;
  --text-light: #f5f5f7;
  --border-color: #e5e5e7;
  --accent-blue: #0071e3;
  --accent-blue-hover: #0077ed;
  --accent-blue-light: #e8f2ff;
  --success: #34c759;
  --warning: #ff9500;
  --danger: #ff3b30;
  --radius-card: 14px;
  --radius-btn: 8px;
  --radius-input: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0071e3, #42a5f5);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(0,113,227,0.3);
  object-fit: cover;
}

.brand-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.2px;
}

.brand-sub {
  font-size: 11px;
  color: #a1a1a6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.menu-section {
  font-size: 11px;
  text-transform: uppercase;
  color: #86868b;
  letter-spacing: 0.8px;
  padding: 12px 12px 6px;
  font-weight: 600;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #e3e3e8;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.menu-item a:hover {
  background-color: rgba(255,255,255,0.08);
  color: #ffffff;
}

.menu-item.active a {
  background-color: var(--accent-blue);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,113,227,0.4);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(0,0,0,0.2);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #3a3a3c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.user-role {
  font-size: 11px;
  color: #a1a1a6;
  text-transform: capitalize;
}

/* Main Content Area */
.main-wrapper {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 64px;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.search-box {
  position: relative;
  width: 320px;
}

.search-box input {
  width: 100%;
  padding: 8px 16px 8px 38px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background-color: #eef0f3;
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  background-color: #ffffff;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

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

.content-body {
  padding: 32px;
  flex: 1;
}

/* Cards & Panels */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Grid & Stat Cards */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-blue);
}

.stat-card.stat-green::before { background: var(--success); }
.stat-card.stat-orange::before { background: var(--warning); }
.stat-card.stat-purple::before { background: #af52de; }
.stat-card.stat-teal::before { background: #5956d6; }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.data-table th {
  background-color: #fafafa;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

table.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13.5px;
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background-color: #f8f9fa;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
}

.badge-received { background: #e8f2ff; color: #0066cc; }
.badge-diagnosis { background: #f3e8ff; color: #6b21a8; }
.badge-approval { background: #fff3e8; color: #d97706; }
.badge-parts { background: #fefce8; color: #b45309; }
.badge-repair { background: #e0f2fe; color: #0284c7; }
.badge-qc { background: #e0e7ff; color: #4338ca; }
.badge-ready { background: #dcfce7; color: #15803d; }
.badge-released { background: #f0fdf4; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #dc2626; }

.badge-paid { background: #dcfce7; color: #15803d; }
.badge-partial { background: #fff3e8; color: #d97706; }
.badge-unpaid { background: #fee2e2; color: #dc2626; }

/* Form Controls & Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-btn);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: var(--accent-blue-hover);
  box-shadow: 0 4px 12px rgba(0,113,227,0.3);
}

.btn-secondary {
  background-color: #e5e5e7;
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #d1d1d6;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: #f5f5f7;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* Unified Uiverse-inspired button system for Repair Management. */
.btn {
  --btn-color: #606060;
  --btn-border: #8f9092;
  --btn-top: #fff;
  --btn-bottom: #d8d9db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 150px;
  height: 50px;
  box-sizing: border-box;
  padding: 0 20px;
  outline: none;
  cursor: pointer;
  border: 1px solid var(--btn-border);
  border-radius: 30px;
  background-image: linear-gradient(to top, var(--btn-bottom) 0%, var(--btn-top) 80%, #fdfdfd 100%);
  color: var(--btn-color);
  font-family: "Source Sans Pro", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-shadow: 0 1px rgba(255,255,255,.5);
  transition: all .2s ease;
  text-decoration: none;
}
.btn:hover { box-shadow: 0 4px 3px 1px #fcfcfc, 0 6px 8px #d6d7d9, 0 -4px 4px #cecfD1, 0 -6px 4px #fefefe, inset 0 0 3px 3px #cecfd1; transform: translateY(-1px); }
.btn:active, .btn:focus-visible { box-shadow: 0 4px 3px 1px #fcfcfc, 0 6px 8px #d6d7d9, 0 -4px 4px #cecfD1, 0 -6px 4px #fefefe, inset 0 0 5px 3px #999, inset 0 0 30px #aaa; transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-sm { min-width: auto; height: 36px; padding: 0 13px; border-radius: 22px; font-size: 12px; }
.btn-primary { --btn-color: #fff; --btn-border: #1d4ed8; --btn-top: #60a5fa; --btn-bottom: #2563eb; text-shadow: 0 1px rgba(0,0,0,.25); }
.btn-success { --btn-color: #fff; --btn-border: #047857; --btn-top: #34d399; --btn-bottom: #059669; text-shadow: 0 1px rgba(0,0,0,.25); }
.btn-danger { --btn-color: #fff; --btn-border: #b91c1c; --btn-top: #f87171; --btn-bottom: #dc2626; text-shadow: 0 1px rgba(0,0,0,.25); }
.btn-warning { --btn-color: #713f12; --btn-border: #d97706; --btn-top: #fde68a; --btn-bottom: #f59e0b; }
.btn-info { --btn-color: #fff; --btn-border: #0369a1; --btn-top: #38bdf8; --btn-bottom: #0284c7; text-shadow: 0 1px rgba(0,0,0,.2); }
.btn-secondary, .btn-outline { --btn-color: #606060; --btn-border: #8f9092; }
.btn-purple { --btn-color: #fff; --btn-border: #6d28d9; --btn-top: #a78bfa; --btn-bottom: #7c3aed; text-shadow: 0 1px rgba(0,0,0,.2); }
@media (max-width: 700px) { .btn { min-width: 0; height: 44px; padding: 0 14px; } .btn-sm { height: 36px; } }

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-card);
  width: 90%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-backdrop.active .modal-box {
  transform: scale(1);
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: #fafafa;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 24px;
  margin-top: 16px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-color);
}

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

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 2px var(--accent-blue);
}

.timeline-content {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
}

.timeline-status {
  font-weight: 700;
  font-size: 13.5px;
}

.timeline-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(1, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .grid-cols-4, .grid-cols-2 { grid-template-columns: 1fr; }
  .search-box { display: none; }
}
