/* ========================================
   UNIFIED THEME - BPO & MP Panel
   Based on PROTOKOL Design System
   Light/Dark Mode Support
   ======================================== */

:root {
  /* Light Mode Colors */
  --bg-primary: #E8F0FA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F5F8FB;
  --text-primary: #1A1D2E;
  --text-secondary: #5A5F7D;
  --text-muted: #8B90A8;
  --border-color: #E0E5ED;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  
  /* Accent Colors */
  --accent-primary: #5B5FEF;
  --accent-hover: #4A4ED8;
  --success: #10B981;
  --success-bg: #D1FAE5;
  --warning: #F59E0B;
  --warning-bg: #FEF3C7;
  --orange: #F97316;
  --orange-bg: #FFEDD5;
  --info: #3B82F6;
}

[data-theme="dark"] {
  --bg-primary: #0F1419;
  --bg-secondary: #1A1F2E;
  --bg-tertiary: #252A3A;
  --text-primary: #E8EBF0;
  --text-secondary: #A8AEBF;
  --text-muted: #6B7280;
  --border-color: #2D3348;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
  --success-bg: rgba(16, 185, 129, 0.2);
  --warning-bg: rgba(245, 158, 11, 0.2);
  --orange-bg: rgba(249, 115, 22, 0.2);
}

/* ========================================
   BASE STYLES
   ======================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ========================================
   HEADER
   ======================================== */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.header-title h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.theme-toggle:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ========================================
   CARDS
   ======================================== */

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

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

.card h3, .card h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-primary);
  letter-spacing: -0.3px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* ========================================
   STATUS ITEMS
   ======================================== */

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.status-item:last-child {
  border-bottom: none;
}

.status-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
}

.status-value {
  font-weight: 600;
  font-size: 14px;
}

.status-value.ok {
  color: var(--success);
}

.status-value.warn {
  color: var(--warning);
}

.status-value.err {
  color: var(--orange);
}

/* ========================================
   TABLES
   ======================================== */

.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
}

thead {
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border-color);
}

th {
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: var(--bg-tertiary);
}

/* ========================================
   BADGES
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

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

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

.badge-orange {
  background: var(--orange-bg);
  color: var(--orange);
}

.badge-info {
  background: #DBEAFE;
  color: var(--info);
}

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

.badge-running {
  background: #DBEAFE;
  color: var(--info);
}

.badge-done {
  background: var(--success-bg);
  color: var(--success);
}

.badge-fail {
  background: var(--orange-bg);
  color: var(--orange);
}

.badge-pass {
  background: var(--success-bg);
  color: var(--success);
}

.badge-confirmed {
  background: var(--success-bg);
  color: var(--success);
}

.badge-ok {
  background: var(--success-bg);
  color: var(--success);
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  justify-content: center;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

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

.btn-success:hover {
  background: #059669;
}

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

.btn-warning:hover {
  background: #D97706;
}

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

.btn-orange:hover {
  background: #EA580C;
}

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
}

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

/* ========================================
   UTILITIES
   ======================================== */

.timestamp {
  color: var(--text-muted);
  font-size: 12px;
}

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
  font-size: 14px;
}

.error-message {
  color: var(--orange);
  font-size: 12px;
  margin-top: 4px;
}

code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: var(--text-primary);
}

.text-muted {
  color: var(--text-muted);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  body {
    padding: 12px;
  }
  
  .header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .header-actions {
    width: 100%;
    justify-content: center;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  table {
    font-size: 13px;
  }
  
  th, td {
    padding: 10px;
  }
}
