/* ============================================================
   ARUNE SUPERSEO v2.1 — LAYOUT
   App shell, sidebar, topbar, main content, responsive
   ============================================================ */

/* ── App Shell ────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--color-bg);
  position: relative;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--gradient-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--z-sticky);
  transition: transform var(--transition-med);
  box-shadow: 4px 0 32px rgba(0,0,0,0.4);
}

/* ── Sidebar Logo ─────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  min-height: 80px;
}

.logo-img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
}

.logo-icon-fallback {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow-primary);
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.logo-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.1;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Sidebar Navigation ───────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-nav-group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  padding: var(--space-4) var(--space-3) var(--space-2);
  margin-top: var(--space-2);
  user-select: none;
}

.sidebar-nav-group-label:first-child {
  margin-top: 0;
  padding-top: var(--space-2);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  user-select: none;
  border: 1px solid transparent;
}

.sidebar-nav-item:hover {
  color: var(--color-text-primary);
  background: rgba(108,99,255,0.12);
  border-color: rgba(108,99,255,0.2);
  box-shadow: inset 0 0 12px rgba(108,99,255,0.06);
}

.sidebar-nav-item.active {
  color: var(--color-text-primary);
  background: linear-gradient(135deg, rgba(108,99,255,0.25) 0%, rgba(108,99,255,0.1) 100%);
  border-color: rgba(108,99,255,0.35);
  box-shadow: var(--shadow-glow-primary), inset 0 0 16px rgba(108,99,255,0.08);
}

.sidebar-nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px var(--color-primary));
}

.nav-icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.sidebar-nav-item:hover .nav-icon {
  transform: scale(1.1);
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav Badge */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  background: var(--color-primary);
  color: #fff;
  line-height: 1;
  flex-shrink: 0;
}

.nav-badge-warning {
  background: var(--color-warning);
  color: #1A1C30;
}

/* ── Sidebar Footer ───────────────────────────────────────── */
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: rgba(10,11,20,0.5);
}

.sidebar-footer-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.sidebar-footer-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sidebar-footer-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  line-height: 1;
}

.sidebar-footer-value {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mode badge variants used in sidebar footer */
.mode-badge-sandbox {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-warning);
  background: rgba(255,184,48,0.12);
  border: 1px solid rgba(255,184,48,0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.mode-badge-production {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-success);
  background: rgba(34,211,165,0.12);
  border: 1px solid rgba(34,211,165,0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Legacy aliases */
.sidebar-status-text { font-size: var(--text-sm); font-weight: 500; color: var(--color-text-primary); flex: 1; }
.sidebar-mode-text { font-size: var(--text-xs); font-weight: 600; color: var(--color-warning); }

/* ── Main Area ────────────────────────────────────────────── */
.main-area {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-med);
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 260px;
  right: 0;
  height: 64px;
  background: rgba(17,18,36,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  z-index: var(--z-sticky);
  box-shadow: 0 2px 24px rgba(0,0,0,0.35);
  transition: left var(--transition-med);
}

/* Topbar structural groups */
.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.topbar-title-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.topbar-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

/* Legacy aliases */
.topbar-actions { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }

.topbar-agent-run,
.topbar-last-run {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* Mode Badge */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mode-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mode-sandbox {
  background: rgba(255,184,48,0.15);
  color: var(--color-warning);
  border: 1px solid rgba(255,184,48,0.3);
}

.mode-sandbox::before {
  background: var(--color-warning);
  box-shadow: 0 0 6px var(--color-warning);
}

.mode-production {
  background: rgba(34,211,165,0.15);
  color: var(--color-success);
  border: 1px solid rgba(34,211,165,0.3);
}

.mode-production::before {
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
}

/* Hamburger */
.hamburger {
  display: none;
  font-size: var(--text-xl);
  color: var(--color-text-secondary);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: calc(64px + var(--space-6)) var(--space-6) var(--space-8);
  min-height: 100vh;
  overflow-y: auto;
}

/* ── Module Containers ────────────────────────────────────── */
.module-container {
  display: none;
  animation: fadeIn 0.35s ease;
}

.module-container.active {
  display: block;
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--space-8);
}

.page-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
  line-height: var(--lh-tight);
}

.page-subtitle {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--lh-normal);
  max-width: 560px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ── Content Grid ─────────────────────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.content-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.content-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

/* ── Section ──────────────────────────────────────────────── */
.section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Sidebar Overlay (mobile) ─────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: calc(var(--z-sticky) - 1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  /* sidebar.js uses .sidebar-open class */
  .sidebar.open,
  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.6);
  }

  /* sidebar.js uses .visible class on overlay */
  .sidebar-overlay.active,
  .sidebar-overlay.visible {
    display: block;
  }

  .main-area {
    margin-left: 0;
  }

  .topbar {
    left: 0;
  }

  .hamburger {
    display: inline-flex;
  }

  .topbar-agent-run {
    display: none;
  }

  .main-content {
    padding: calc(64px + var(--space-4)) var(--space-4) var(--space-6);
  }

  .content-grid-2,
  .content-grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .page-header-inner {
    flex-direction: column;
  }

  .topbar-title {
    font-size: var(--text-lg);
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 var(--space-4);
    gap: var(--space-2);
  }

  .topbar-actions {
    gap: var(--space-2);
  }

  .mode-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .content-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* -- Sidebar Logo (new index.html structure) ---------------- */
.sidebar-logo-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.sidebar-logo-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.1;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.sidebar-logo-sub {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-collapse-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  display: none;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.06);
}

@media (max-width: 768px) {
  .sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* -- Module Error State -------------------------------------- */
.module-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  gap: 1rem;
  padding: 2rem;
}

.module-error-icon {
  font-size: 3rem;
  opacity: 0.6;
}

.module-error-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
}

.module-error-message {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 480px;
  line-height: 1.6;
  font-family: monospace;
  background: var(--color-surface-2);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

/* -- Modal Close Button -------------------------------------- */
.modal-close-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
}

.modal-close-btn:hover {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.06);
}

/* -- Btn Spinner --------------------------------------------- */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinSlow 0.7s linear infinite;
  margin-right: 4px;
  vertical-align: middle;
}

/* -- Brand Logo in Sidebar ----------------------------------- */
.sidebar-logo {
  min-height: 72px !important;
  padding: 12px 16px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.sidebar-brand-logo {
  width: 160px;
  height: auto;
  max-height: 48px;
  object-fit: contain;
  object-position: center;
  background: white;
  padding: 6px 12px;
  border-radius: 8px;
  filter: drop-shadow(0 4px 12px rgba(108,99,255,0.25));
}



/* ================================================================
   ARUNE INTERIORS — PERMANENT PROFESSIONAL CURSOR OVERRIDE
   Completely destroys trishul-cursor and custom image cursors site-wide.
================================================================ */

*, *::before, *::after, html, body {
  cursor: auto !important;
}

a, button, select, textarea, input, .btn, .btn-one, .theme-btn, .submit-btn, .glass-card, .btn-luxury-gold, .btn-luxury-outline {
  cursor: pointer !important;
}

input[type="text"], input[type="email"], input[type="tel"], textarea {
  cursor: text !important;
}

/* Hard disable any magic-cursor or trishul-cursor elements */
#magic-cursor-dot, #magic-cursor-ring, [class*="trishul"], [id*="trishul"] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
