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

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-width: 50px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  color: white;
  padding: 12px 4px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s ease;
  z-index: 100;
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  background: var(--gray-900);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.3s ease;
}

.sidebar-toggle:hover {
  background: var(--gray-700);
}

.sidebar:not(.hidden) ~ .main .sidebar-toggle {
  left: calc(var(--sidebar-width) + 12px);
}

.main.sidebar-hidden {
  margin-left: 0;
}

.logo {
  text-align: center;
  margin-bottom: 4px;
}

.logo h1 {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.logo .subtitle {
  display: none;
}

.nav {
  margin-top: 16px;
  width: 100%;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 4px;
  color: var(--gray-400);
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 0.2s;
  font-size: 8px;
  text-align: center;
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

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

/* Main Content */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
  transition: margin-left 0.3s ease;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header h2 {
  font-size: 24px;
  font-weight: 600;
}

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

.search-box input {
  padding: 10px 16px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  width: 280px;
  font-size: 14px;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-300);
}

.btn-refresh {
  background: white;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}

.btn-refresh:hover {
  background: var(--gray-50);
}

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

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

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.pending { background: #fef3c7; color: #d97706; }
.stat-icon.confirmed { background: #d1fae5; color: #059669; }
.stat-icon.cancelled { background: #fee2e2; color: #dc2626; }
.stat-icon.no-answer { background: #e0e7ff; color: #4f46e5; }
.stat-icon.today { background: #dbeafe; color: #2563eb; }
.stat-icon.revenue { background: #d1fae5; color: #059669; }

.stat-value {
  font-size: 24px;
  font-weight: 700;
  display: block;
}

.stat-label {
  font-size: 13px;
  color: var(--gray-500);
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: white;
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover {
  background: var(--gray-100);
}

.filter-tab.active {
  background: var(--primary);
  color: white;
}

/* Orders Table */
.orders-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow: hidden;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
}

.orders-table th {
  text-align: left;
  padding: 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.orders-table td {
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}

.orders-table tbody tr:hover {
  background: var(--gray-50);
}

.orders-table .loading {
  text-align: center;
  padding: 48px;
  color: var(--gray-500);
}

.orders-table .address-cell {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-confirmed {
  background: #d1fae5;
  color: #065f46;
}

.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.status-no_answer {
  background: #e0e7ff;
  color: #3730a3;
}

/* Action Buttons */
.action-btns {
  display: flex;
  gap: 8px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.action-btn.view {
  background: var(--gray-100);
  color: var(--gray-600);
}

.action-btn.view:hover {
  background: var(--gray-200);
}

.action-btn.call {
  background: #dbeafe;
  color: #2563eb;
}

.action-btn.call:hover {
  background: #bfdbfe;
}

.action-btn.confirm {
  background: #d1fae5;
  color: #059669;
}

.action-btn.confirm:hover {
  background: #a7f3d0;
}

.action-btn.cancel {
  background: #fee2e2;
  color: #dc2626;
}

.action-btn.cancel:hover {
  background: #fecaca;
}

.action-btn.edit {
  background: #fef3c7;
  color: #d97706;
}

.action-btn.edit:hover {
  background: #fde68a;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid var(--gray-300);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.pagination button:hover {
  background: var(--gray-50);
}

.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content.modal-small {
  max-width: 450px;
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--gray-200);
}

.modal-body {
  padding: 24px;
}

/* Order Detail */
.order-detail {
  display: grid;
  gap: 24px;
}

.detail-section {
  background: var(--gray-50);
  padding: 20px;
  border-radius: 12px;
}

.detail-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-200);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--gray-500);
  font-size: 14px;
}

.detail-value {
  font-weight: 500;
  font-size: 14px;
}

.status-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Call Logs */
.call-logs {
  margin-top: 24px;
}

.call-log-item {
  background: white;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--gray-200);
}

.call-log-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.call-log-agent {
  font-weight: 600;
}

.call-log-time {
  color: var(--gray-500);
  font-size: 13px;
}

.call-log-notes {
  color: var(--gray-600);
  font-size: 14px;
  margin-top: 8px;
}

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

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
}

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

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* Customer Info */
.customer-phone {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-phone a {
  color: var(--primary);
  text-decoration: none;
}

.customer-phone a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .sidebar .logo h1,
  .sidebar .logo .subtitle {
    display: none;
  }
  .nav-item span {
    display: none;
  }
  .main {
    margin-left: 60px;
    padding: 16px;
  }
  .header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  .search-box input {
    width: 100%;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .orders-table {
    font-size: 12px;
  }
  .orders-table th,
  .orders-table td {
    padding: 12px 8px;
  }
}
