/* 7portal.online — Custom styles on top of Tailwind CDN */
/* Matches the existing React app's dark theme exactly */

:root {
  --bg-primary:   #0a0a0f;
  --bg-secondary: #111118;
  --bg-card:      rgba(255,255,255,0.04);
  --border:       rgba(255,255,255,0.08);
  --text-primary: #f1f5f9;
  --text-muted:   #6b7280;
  --indigo:       #FFED00;
  --indigo-light: #FFF250;
  --indigo-hover: #e6d600;
  --on-indigo:    #000;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter Tight', Inter, system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Layout */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 100vh;
  overflow: hidden;
  transition: grid-template-columns 0.25s ease;
}
.app-layout.sidebar-collapsed { grid-template-columns: 0 1fr; }
.app-layout.sidebar-collapsed .sidebar {
  border-right-width: 0;
  visibility: hidden;
  opacity: 0;
}
.sidebar { transition: opacity 0.2s ease; }

@media (max-width: 1024px) {
  .app-layout, .app-layout.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar     { display: none !important; position: fixed; inset: 0; z-index: 40; visibility: visible; opacity: 1; max-width: 320px; box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
  .sidebar.open{ display: flex !important; }
}

/* Sidebar */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Main content */
.main-content {
  overflow-y: auto;
  background: var(--bg-primary);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
}
.card-sm { padding: 0.75rem; }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--indigo);
  color: var(--on-indigo);
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover { background: var(--indigo-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.10); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.15s;
}
.btn-ghost:hover { color: var(--text-primary); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  padding: 0.375rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

/* Inputs */
.input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--indigo); }
.input::placeholder { color: var(--text-muted); }

select.input option { background: #1e1e2e; color: var(--text-primary); }

textarea.input { resize: vertical; min-height: 80px; }

/* Nav link */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  text-decoration: none;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
}
.nav-link.active { color: var(--indigo-light); }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.hidden { display: none; }
.modal-box {
  background: #151520;
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Task item animations */
[data-task-id] { animation: task-in 0.15s ease; }
@keyframes task-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Label color swatches */
.label-swatch {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}
.label-swatch:hover, .label-swatch.selected { border-color: #fff; transform: scale(1.15); }

/* Login page */
.login-bg {
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1a1a2e 0%, #0a0a0f 60%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
}

/* Toast container (managed by JS) */
#toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; }

/* Chart placeholders */
.chart-bar {
  background: var(--indigo);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
  min-height: 2px;
}

/* Drag-drop ghost */
.drag-ghost { opacity: 0.5; border: 1px dashed var(--indigo) !important; }

/* Cross-panel drop target highlight */
.drop-target-active {
  outline: 2px dashed var(--indigo);
  outline-offset: -4px;
  background: rgba(255, 237, 0, 0.05);
}

/* Accordions */
.accordion-trigger { cursor: pointer; user-select: none; }
.accordion-content { overflow: hidden; transition: max-height 0.2s ease; }
.accordion-content.closed { max-height: 0; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  border-radius: 99px;
  font-size: 0.625rem;
  font-weight: 700;
}
.badge-indigo { background: var(--indigo); color: var(--on-indigo); }
.badge-red    { background: #ef4444; color: #fff; }

/* Spinner */
.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-sm { width: 0.75rem; height: 0.75rem; border-width: 1.5px; }

/* Hide native number-input spinners (Chrome/Safari/Firefox) */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Admin dashboard tiles */
.admin-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
  text-align: center;
  min-height: 140px;
}
.admin-tile:hover {
  border-color: rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.02);
  transform: translateY(-2px);
}
.admin-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
}
.admin-tile-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
}
.admin-tile-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Toggle switch */
.toggle-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  background: rgba(239, 68, 68, 0.4);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  margin: 0;
}
.toggle-switch::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-switch:checked {
  background: rgba(34, 197, 94, 0.7);
}
.toggle-switch:checked::before {
  transform: translateX(16px);
}
.toggle-switch:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

/* ── Brand color override (Tailwind indigo → yellow #FFED00) ──────────────── */
.text-indigo-300, .text-indigo-400, .text-indigo-500, .text-indigo-600, .text-indigo-700 {
  color: #FFED00 !important;
}
.bg-indigo-400, .bg-indigo-500, .bg-indigo-600, .bg-indigo-700 {
  background-color: #FFED00 !important;
}
.border-indigo-400, .border-indigo-500, .border-indigo-600 {
  border-color: #FFED00 !important;
}
.accent-indigo-400, .accent-indigo-500, .accent-indigo-600 {
  accent-color: #FFED00 !important;
}
/* Auto-contrast: dark text on yellow backgrounds */
.bg-indigo-400.text-white, .bg-indigo-500.text-white, .bg-indigo-600.text-white, .bg-indigo-700.text-white,
.bg-indigo-500 .text-white, .bg-indigo-600 .text-white {
  color: #000 !important;
}
/* Opacity variants (Tailwind /10, /15, /20, /30 syntax) */
[class*="bg-indigo-400/10"], [class*="bg-indigo-500/10"], [class*="bg-indigo-600/10"] { background-color: rgba(255,237,0,0.10) !important; }
[class*="bg-indigo-400/15"], [class*="bg-indigo-500/15"], [class*="bg-indigo-600/15"] { background-color: rgba(255,237,0,0.15) !important; }
[class*="bg-indigo-400/20"], [class*="bg-indigo-500/20"], [class*="bg-indigo-600/20"] { background-color: rgba(255,237,0,0.20) !important; }
[class*="bg-indigo-400/30"], [class*="bg-indigo-500/30"], [class*="bg-indigo-600/30"] { background-color: rgba(255,237,0,0.30) !important; }
[class*="border-indigo-400/20"], [class*="border-indigo-500/20"], [class*="border-indigo-600/20"] { border-color: rgba(255,237,0,0.20) !important; }

/* Visual Editor inspector */
body.ve-active * { cursor: crosshair !important; }
body.ve-active #ve-panel, body.ve-active #ve-panel * { cursor: auto !important; }
body.ve-active #btn-visual-edit { background: rgba(255, 237, 0, 0.25); color: #FFED00; }
.ve-hover    { outline: 2px dashed #38bdf8 !important; outline-offset: -2px; }
.ve-selected { outline: 2px solid #FFED00 !important; outline-offset: -2px; box-shadow: 0 0 0 4px rgba(255,237,0,0.15); }

#ve-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  background: #0e0e16;
  border-left: 1px solid rgba(255,255,255,0.10);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}

/* Push body content to the left so the panel does not cover it */
body { transition: padding-right 0.2s ease; }
body.ve-active { padding-right: 340px; }
.ve-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.ve-tabs       { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.ve-tab        { flex: 1; padding: 6px 10px; font-size: 11px; color: var(--text-muted); background: transparent; border: none; cursor: pointer; border-radius: 6px 6px 0 0; }
.ve-tab.active { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.ve-tab-body   { flex: 1; overflow-y: auto; padding: 12px 14px; }
.ve-panel-foot { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid rgba(255,255,255,0.08); }

@media (max-width: 640px) {
  #ve-panel { width: 100%; }
  body.ve-active { padding-right: 0; }
}

/* Responsive helpers */
@media (max-width: 640px) {
  .modal-box { padding: 1rem; }
  .card      { padding: 0.75rem; }
  .admin-tile { min-height: 110px; padding: 1rem 0.5rem; }
}
