/* ==========================================================================
   CloudMatrix Admin Console Styling
   State of the Art Dark Glassmorphic Theme with Vibrant Accents
   ========================================================================== */

:root {
  --bg-dark: #0b0f19;
  --bg-surface: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.7);
  --bg-input: #1f2937;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #3b82f6;

  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-faint: #6b7280;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.25);

  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.2);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Auth Overlay / Lock Screen ───────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.92);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-card), 0 0 30px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: fadeInDown 0.3s ease-out;
}

.auth-icon {
  font-size: 2.75rem;
  margin-bottom: 1rem;
}

.auth-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.auth-form .form-group {
  text-align: left;
  margin-bottom: 1.25rem;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-danger);
  color: #fca5a5;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: left;
}

.auth-footer {
  margin-top: 1.75rem;
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ─── Layout & Header ─────────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-header {
  height: 70px;
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-logo {
  font-size: 1.5rem;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulseGlow 2s infinite;
}

.version-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

/* ─── Navigation Tabs ─────────────────────────────────────────────────── */
.admin-nav {
  background: rgba(17, 24, 39, 0.5);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.nav-tab.active {
  color: #60a5fa;
  border-bottom-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
}

.tab-icon {
  font-size: 1.1rem;
}

/* ─── Main Content ────────────────────────────────────────────────────── */
.admin-main {
  flex: 1;
  padding: 2rem;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

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

.pane-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.pane-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pane-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ─── Cards & Containers ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

/* ─── Tables ──────────────────────────────────────────────────────────── */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}

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

.data-table th {
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.code-cell {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #93c5fd;
}

.price-cell {
  font-weight: 600;
  font-family: var(--font-mono);
}

.inr-val {
  color: #34d399;
}

.usd-val {
  color: #38bdf8;
}

/* ─── Filters & Search Bar ────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 0.9rem;
}

.search-box input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.filter-group select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}

.sku-count-badge {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* ─── Bulk Adjuster Layout ────────────────────────────────────────────── */
.bulk-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}

.quick-pct-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-pct {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-pct:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
}

.preview-stats {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.stat-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  flex: 1;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ─── File Upload & Dropzone ──────────────────────────────────────────── */
.file-sync-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}

.dropzone {
  border: 2px dashed rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.03);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 1rem;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
}

.dropzone-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.dropzone h4 {
  font-size: 1rem;
  font-weight: 600;
}

.dropzone-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.dropzone-types {
  display: block;
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
}

.selected-file-info {
  margin-top: 1rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--accent-green);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #6ee7b7;
}

.btn-clear-file {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

.diff-placeholder {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
}

.diff-icon {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 0.75rem;
}

.diff-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ─── API Studio ──────────────────────────────────────────────────────── */
.api-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}

.input-with-action {
  display: flex;
  gap: 0.5rem;
}

.input-with-action input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.endpoint-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.endpoint-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.http-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.http-badge.put { background: #d97706; color: #fff; }
.http-badge.post { background: #059669; color: #fff; }
.http-badge.get { background: #2563eb; color: #fff; }

.code-tabs {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.code-tab {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.code-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.code-block {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #a5b4fc;
  margin-top: 0.6rem;
  line-height: 1.6;
}

.interactive-tester {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-row .col {
  flex: 1;
}

.api-response-box {
  background: #060911;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.api-response-box h5 {
  font-size: 0.8rem;
  color: #34d399;
  margin-bottom: 0.5rem;
}

.api-response-box pre {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #e2e8f0;
  white-space: pre-wrap;
}

/* ─── Forms, Inputs & Buttons ─────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s;
}

input:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.input-with-prefix, .input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.input-with-prefix input {
  padding-left: 2.25rem;
}

.input-suffix {
  position: absolute;
  right: 1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.input-with-suffix input {
  padding-right: 2.25rem;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.35rem;
}

.btn {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.45);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.alert-box {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

/* ─── Modal Overlay ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1.5rem;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: fadeInDown 0.2s ease-out;
}

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

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.sku-meta-info {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
}

/* ─── Toast Notifications ─────────────────────────────────────────────── */
.admin-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  font-size: 0.88rem;
  z-index: 10000;
  display: none;
  animation: slideInUp 0.25s ease-out;
}

.admin-toast.show {
  display: block;
}

/* Utilities */
.text-center { text-align: center; }
.text-green { color: #34d399; }
.text-link { color: #60a5fa; text-decoration: underline; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media (max-width: 1024px) {
  .bulk-grid, .file-sync-grid, .api-grid {
    grid-template-columns: 1fr;
  }
}
