/* ----------------------------------------------------
   ROBOCOOP CONTROL PANEL - LIGHT MODE PREMIUM STYLES
   ---------------------------------------------------- */

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-sidebar: #0f172a;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-white: #ffffff;
  
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-blue-light: #eff6ff;
  
  --accent-emerald: #10b981;
  --accent-emerald-light: #ecfdf5;
  
  --accent-red: #ef4444;
  --accent-red-hover: #dc2626;
  --accent-red-light: #fef2f2;
  
  --accent-amber: #f59e0b;
  --accent-amber-light: #fffbeb;

  --accent-indigo: #6366f1;
  --accent-indigo-light: #eef2ff;
  
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  --font-main: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-logo: 'Outfit', system-ui, sans-serif;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* ----------------------------------------------------
   UTILITIES
   ---------------------------------------------------- */
.hide {
  display: none !important;
}

.text-blue { color: var(--accent-blue) !important; }
.text-emerald { color: var(--accent-emerald) !important; }
.text-red { color: var(--accent-red) !important; }
.text-amber { color: var(--accent-amber) !important; }
.text-indigo { color: var(--accent-indigo) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

.py-md { padding-top: 16px !important; padding-bottom: 16px !important; }
.py-lg { padding-top: 32px !important; padding-bottom: 32px !important; }
.margin-top-sm { margin-top: 8px !important; }
.margin-top-md { margin-top: 16px !important; }
.margin-top-lg { margin-top: 24px !important; }
.margin-bottom-md { margin-bottom: 16px !important; }

/* Grid Layouts */
.grid {
  display: grid;
  gap: 24px;
}
.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ----------------------------------------------------
   LOCK SCREEN PIN BARRIER
   ---------------------------------------------------- */
.pin-barrier {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.pin-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.lock-icon-container {
  width: 64px;
  height: 64px;
  background-color: var(--accent-blue-light);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 20px auto;
}

.lock-icon {
  color: var(--accent-blue);
  width: 28px;
  height: 28px;
}

.pin-header h2 {
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: 24px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.pin-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.pin-form input {
  width: 100%;
  padding: 16px;
  font-size: 28px;
  letter-spacing: 8px;
  text-align: center;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  transition: all 0.2s ease;
  font-family: monospace;
}

.pin-form input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.pin-form .input-with-icon input {
  font-size: 14px !important;
  letter-spacing: normal !important;
  text-align: left !important;
  font-family: var(--font-main) !important;
  padding: 12px 16px 12px 48px !important;
  margin-bottom: 0 !important;
}

.error-msg {
  color: var(--accent-red);
  font-size: 13px;
  margin-top: 12px;
  font-weight: 500;
}

/* ----------------------------------------------------
   SIDEBAR
   ---------------------------------------------------- */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  padding: 24px;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.logo-circle {
  width: 44px;
  height: 44px;
  background-color: var(--accent-blue);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.logo-icon {
  color: var(--text-white);
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  font-family: var(--font-logo);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-text p {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

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

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

.nav-item.active {
  background-color: var(--accent-blue);
  color: var(--text-white);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 8px 0;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
}

/* ----------------------------------------------------
   MAIN CONTENT HEADER
   ---------------------------------------------------- */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.header-title h2 {
  font-family: var(--font-logo);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-title p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ----------------------------------------------------
   CONTENT PANELS
   ---------------------------------------------------- */
.content-wrapper {
  padding: 32px;
  overflow-y: auto;
  flex-grow: 1;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------
   CARDS
   ---------------------------------------------------- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

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

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

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-header i {
  width: 20px;
  height: 20px;
}

.card-body {
  padding: 24px;
}

.desc-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* Compact Card (for stats) */
.card-compact .card-body {
  padding: 20px;
}

/* ----------------------------------------------------
   SYSTEM STATS CARDS
   ---------------------------------------------------- */
.stat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-icon {
  width: 18px;
  height: 18px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: var(--font-logo);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.stat-bar-wrapper {
  width: 100%;
  height: 6px;
  background-color: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.stat-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-bar-blue { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.stat-bar-emerald { background: linear-gradient(90deg, #34d399, #10b981); }
.stat-bar-amber { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.stat-bar-red { background: linear-gradient(90deg, #f87171, #ef4444); }

.stat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ----------------------------------------------------
   BUTTONS
   ---------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

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

.btn-primary:hover {
  background-color: var(--accent-blue-hover);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.15);
}

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

.btn-outline:hover {
  background-color: var(--border-light);
  color: var(--text-primary);
}

.btn-outline-danger {
  background-color: transparent;
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}

.btn-outline-danger:hover {
  background-color: var(--accent-red-light);
  border-color: var(--accent-red);
}

.btn-danger-sm {
  background-color: var(--accent-red-light);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.1);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
}

.btn-danger-sm:hover {
  background-color: var(--accent-red);
  color: var(--text-white);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ----------------------------------------------------
   BADGES
   ---------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  line-height: 1;
}

.badge-success {
  background-color: var(--accent-emerald-light);
  color: var(--accent-emerald);
}

.badge-success i {
  width: 14px;
  height: 14px;
}

/* ----------------------------------------------------
   STATUS CONTAINERS
   ---------------------------------------------------- */
.status-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
}

.status-circle::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0.4;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

.status-green {
  background-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.status-red {
  background-color: var(--accent-red);
  color: var(--accent-red);
}

.status-text {
  font-weight: 600;
  font-size: 15px;
}

.status-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.card-action-bar {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

/* ----------------------------------------------------
   FORM ELEMENTS
   ---------------------------------------------------- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input {
  width: 100%;
  padding: 12px 16px 12px 48px;
  font-size: 14px;
  font-family: var(--font-main);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  transition: all 0.2s ease;
}

.input-with-icon input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.helper-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

textarea {
  width: 100%;
  padding: 16px;
  font-size: 14px;
  font-family: 'JetBrains Mono', Courier, monospace;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  resize: vertical;
  transition: all 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.form-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 24px 0;
}

/* Bot Name Group */
.bot-name-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Toggle Switch Styles */
.toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  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: #cbd5e1;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
}

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

input:focus + .slider {
  box-shadow: 0 0 1px var(--accent-blue);
}

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

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* ----------------------------------------------------
   DRAG AND DROP UPLOAD ZONE
   ---------------------------------------------------- */
.drag-drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: var(--border-light);
}

.drag-drop-zone:hover, .drag-drop-zone.active {
  border-color: var(--accent-blue);
  background-color: var(--accent-blue-light);
}

.upload-icon {
  width: 44px;
  height: 44px;
  color: var(--accent-blue);
  margin-bottom: 12px;
}

.drag-drop-zone p {
  font-size: 14px;
  color: var(--text-secondary);
}

.drag-drop-zone p span {
  color: var(--accent-blue);
  font-weight: 600;
}

/* Progress indicator */
.upload-progress-container {
  margin-top: 16px;
  padding: 12px;
  background-color: var(--border-light);
  border-radius: var(--radius-sm);
}

.progress-bar-wrapper {
  width: 100%;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--accent-blue);
  transition: width 0.1s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ----------------------------------------------------
   TABLES
   ---------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.table th, .table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.table th {
  background-color: var(--border-light);
  font-weight: 600;
  color: var(--text-primary);
}

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

/* ----------------------------------------------------
   WHATSAPP QR CODE SECTION
   ---------------------------------------------------- */
.qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--border-light);
  margin: 0 auto;
  max-width: 320px;
}

.qr-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3.5px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.qr-text-ascii {
  font-family: monospace;
  font-size: 8px;
  line-height: 1.1;
  letter-spacing: -1px;
  background-color: #ffffff;
  padding: 16px;
  border-radius: var(--radius-sm);
  color: #000000;
  user-select: none;
}

/* ----------------------------------------------------
   LOG VIEWER
   ---------------------------------------------------- */
.log-viewer {
  background-color: #0c1222;
  color: #d4d4d8;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  min-height: 500px;
  max-height: 600px;
  overflow-y: auto;
  overflow-x: auto;
  padding: 20px 24px;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-viewer::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.log-viewer::-webkit-scrollbar-track {
  background: #1e293b;
}

.log-viewer::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

.log-viewer::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.log-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  gap: 12px;
  color: var(--text-muted);
}

.log-placeholder p {
  font-family: var(--font-main);
  font-size: 14px;
}

.log-select {
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
}

/* ----------------------------------------------------
   TOAST NOTIFICATION MODAL
   ---------------------------------------------------- */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-left: 4px solid var(--accent-blue);
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10000;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 13.5px;
  font-weight: 500;
  max-width: 420px;
}

@keyframes slideIn {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast-notification.success {
  border-left-color: var(--accent-emerald);
  color: var(--text-primary);
}

.toast-notification.error {
  border-left-color: var(--accent-red);
  color: var(--accent-red);
}

.toast-notification.warning {
  border-left-color: var(--accent-amber);
  color: var(--accent-amber);
}

.toast-notification i {
  width: 18px;
  height: 18px;
}

/* ----------------------------------------------------
   EMBED CODE CONTAINER
   ---------------------------------------------------- */
.code-box-container {
  position: relative;
  background-color: var(--bg-sidebar);
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  margin-top: 12px;
}

.code-box-container pre {
  font-family: 'JetBrains Mono', Courier, monospace;
  font-size: 12px;
  color: #a5f3fc; /* Cyan-200 */
  margin: 0;
  white-space: pre-wrap;
}

.btn-copy {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-white);
  border: none;
}

.btn-copy:hover {
  background-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}
