/* Base Styles & Variables */
:root {
  --bg-color: #f8fafc;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --card-bg: #ffffff;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --transition: all 0.15s ease-in-out;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
  display: flex;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4 {
  color: var(--text-dark);
  font-weight: 600;
}
p {
  color: var(--text-muted);
  line-height: 1.5;
}

/* Layout */
.app-container {
  display: flex;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  transition: var(--transition);
}
.sidebar-header {
  padding: 24px 20px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sidebar-text-active);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-nav {
  padding: 20px 0;
  flex-grow: 1;
}
.sidebar-nav ul {
  list-style: none;
}
.sidebar-nav li {
  margin-bottom: 4px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background-color: rgba(255,255,255,0.05);
  color: var(--sidebar-text-active);
}
.sidebar-nav a .icon {
  margin-right: 12px;
  font-size: 1.25rem;
}

/* Main Content */
.main-content {
  flex-grow: 1;
  padding: 32px;
  overflow-y: auto;
  min-width: 0;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.page-header h1 {
  font-size: 1.75rem;
}

/* Cards */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  overflow: hidden;
  transition: var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 1.1rem;
}
.card-body {
  padding: 24px;
}
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background-color: #fcfcfc;
}

/* Stat Cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
}
.stat-icon {
  font-size: 2rem;
  margin-right: 16px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: rgba(0,0,0,0.03);
}
.stat-details h3 {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}
.stat-details .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}
.btn-secondary {
  background-color: white;
  color: var(--text-dark);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: #f1f5f9;
}
.btn-danger {
  background-color: var(--danger);
  color: white;
}
.btn-danger:hover {
  background-color: #dc2626;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-dark);
}
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-dark);
  transition: var(--transition);
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-group input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Tables */
.table-container {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.data-table th, .data-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
}
.data-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  background-color: #f8fafc;
}
.data-table tbody tr:hover {
  background-color: #f1f5f9;
}
.data-table td {
  font-size: 0.875rem;
}

/* Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background-color: #dcfce7; color: #166534; }
.badge-error { background-color: #fee2e2; color: #991b1b; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-pending { background-color: #f1f5f9; color: #475569; }
.badge-processing { background-color: #dbeafe; color: #1e40af; }

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background-color: #fafafa;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background-color: #eff6ff;
}
.drop-zone-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}
.drop-zone-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 8px;
}
.drop-zone-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.drop-zone input[type="file"] {
  display: none;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: var(--transition);
}
.modal-overlay.active .modal {
  transform: translateY(0);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 1.1rem;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  padding: 16px 24px;
  border-radius: var(--radius);
  background-color: white;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  transform: translateX(100%);
  opacity: 0;
  animation: slideIn 0.3s forwards;
  border-left: 4px solid var(--primary);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-info { border-left-color: var(--primary); }

@keyframes slideIn {
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; }
}

/* Activity Feed */
.activity-feed {
  list-style: none;
}
.activity-feed li {
  display: flex;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}
.activity-feed li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.activity-icon {
  font-size: 1.5rem;
  margin-right: 16px;
  margin-top: 2px;
}
.activity-content p {
  color: var(--text-dark);
  margin-bottom: 4px;
}
.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Misc Utilities */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}
.preview-table th, .preview-table td {
  padding: 8px 12px;
  font-size: 0.8rem;
}
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.text-danger { color: var(--danger); }

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 16px;
  }
  .sidebar-nav a .text {
    display: inline;
  }
  .sidebar-header {
    border-bottom: none;
    padding: 0 0 16px 0;
  }
  .main-content {
    padding: 16px;
  }
  .stat-cards {
    grid-template-columns: 1fr;
  }
}
