/**
 * layout.css — Layouts principaux OMNI
 * Sidebar, topbar, feed, grilles, responsive
 */

/* ─── CONTENEUR RACINE ─── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(5, 4, 2, 0.95);
  border-right: 1px solid rgba(255,140,0,0.06);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
}

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

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 700; letter-spacing: 0.15em;
  background: linear-gradient(90deg, #CC6600, #FF8C00, #FFCF70, #fff, #FFCF70, #FF8C00, #CC6600);
  background-size: 300% 100%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: shimmerSweep 4s ease-in-out infinite;
}

.sidebar-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 8px;
  border-radius: 4px;
}

.sidebar-section {
  padding: 16px 12px 8px;
}

.sidebar-section-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 0 8px;
  margin-bottom: 8px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
}

/* Navigation items */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  cursor: pointer;
  border-radius: 10px;
  margin: 0 8px 3px;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
}
.nav-item:hover { background: rgba(255, 140, 0, 0.08); color: var(--text-primary); }
.nav-item.active {
  background: rgba(255,140,0,0.10);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 16px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255,140,0,0.4);
}
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 0.95rem; }
.nav-item .nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

/* Historique sidebar */
.sidebar-history {
  flex: 1; overflow-y: auto;
  padding: 0 8px;
}

.history-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}
.history-item:hover { background: rgba(255, 140, 0, 0.06); }

.history-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 4px currentColor;
}
.history-dot.green { background: var(--success); color: var(--success); }
.history-dot.blue { background: var(--accent); color: var(--accent); }
.history-dot.yellow { background: var(--warning); color: var(--warning); }

.history-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.history-time {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.3px;
}

/* ─── QUOTA BAR ─── */
.quota-bar {
  padding: 12px 20px 14px;
  border-top: 1px solid var(--glass-border);
}
.quota-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.quota-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.quota-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-primary);
}
.quota-track {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.quota-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.quota-fill.warning {
  background: linear-gradient(90deg, var(--warning), #f59e0b);
}
.quota-fill.critical {
  background: linear-gradient(90deg, var(--danger), #ef4444);
}
.quota-plan-info {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* ─── SIDEBAR AUTONOMY WIDGET ─── */
.sidebar-autonomy {
  padding: 10px 14px; margin: 0 12px 8px;
  border-radius: 10px; background: var(--surface);
  border: 1px solid var(--glass-border); cursor: pointer;
  transition: border-color 0.3s;
}
.sidebar-autonomy:hover { border-color: rgba(255,140,0,0.25); }
.sidebar-autonomy-header { display: flex; align-items: center; justify-content: space-between; }
.sidebar-autonomy-level { font-family: var(--font-display); font-size: 0.78rem; font-weight: 700; color: var(--accent); }
.sidebar-autonomy-name { font-size: 0.48rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.sidebar-autonomy-bar { height: 3px; border-radius: 2px; background: var(--border); margin-top: 6px; overflow: hidden; }
.sidebar-autonomy-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent-secondary), var(--accent), #FFCF70); transition: width 1s ease; }

/* ─── SIDEBAR FOOTER ─── */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--bg-primary);
}
.user-info { flex: 1; }
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-plan {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
}

/* ─── ZONE PRINCIPALE ─── */
.main {
  flex: 1;
  display: flex; flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ─── TOPBAR ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid rgba(255,140,0,0.05);
  background: rgba(5, 4, 2, 0.7);
  backdrop-filter: blur(20px);
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}
.topbar-status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: blink 2s ease-in-out infinite;
}
.topbar-actions { display: flex; gap: 8px; }
.topbar-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.topbar-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* ─── ZONE FEED / CHAT ─── */
.feed {
  flex: 1;
  overflow-y: auto;
  position: relative;
  padding: 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ─── WELCOME SECTION ─── */
.feed-welcome {
  text-align: center;
  padding: 48px 20px 16px;
  position: relative;
}
.feed-welcome::before {
  content: '';
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255,140,0,0.06) 0%, rgba(255,140,0,0.02) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.feed-welcome > * { position: relative; z-index: 1; }
.feed-welcome-logo {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #FFCF70, #FF8C00, #CC6600);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
  display: inline-block;
}
.feed-welcome h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
  background: linear-gradient(135deg, #f0f4f8 0%, #94a3b8 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.feed-welcome p {
  color: var(--text-muted);
  font-size: 0.82rem;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}
.welcome-demo-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255,140,0,0.06);
  border: 1px solid rgba(255,140,0,0.1);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ─── TEMPLATES LABEL ─── */
.templates-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 3px;
  text-align: center;
  margin: 28px 0 14px;
  position: relative;
}
.templates-label::before, .templates-label::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,140,0,0.15));
}
.templates-label::before { right: calc(50% + 100px); }
.templates-label::after { left: calc(50% + 100px); background: linear-gradient(90deg, rgba(255,140,0,0.15), transparent); }
.template-tabs { display:none; }

/* ─── TRANSITIONS DE VUE ─── */
.feed > * { animation: viewFadeIn 0.3s ease; }
@keyframes viewFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.view-exit { animation: viewFadeOut 0.15s ease forwards; }
@keyframes viewFadeOut { to { opacity: 0; transform: translateY(-4px); } }

/* ─── BOUTON HAMBURGER (mobile) ─── */
.hamburger-btn {
  display: none;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.hamburger-btn:hover { border-color: var(--accent); color: var(--accent); }
.hamburger-btn svg { display: block; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  animation: fadeIn 0.2s ease;
}
.sidebar-backdrop.show { display: block; }

/* ─── EXECUTE VIEW ─── */
#view-execute {
  padding: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  display: none;
}

#view-execute .exec-header-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

#view-execute .exec-header-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

#view-execute .cmd-bar {
  background: var(--bg-secondary);
  border: 1px solid rgba(249,115,22,0.3);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  position: relative;
}

#view-execute .cmd-bar-label {
  font-size: 0.75rem;
  color: #f97316;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

#view-execute .plan-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#view-execute .receipt-panel {
  background: var(--bg-secondary);
  border: 1px solid rgba(255,140,0,0.12);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

#view-execute .playbooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .topbar { padding: 12px 20px; }
  .feed { padding: 20px 24px; }
  .command-area { padding: 10px 20px 14px; }
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 100; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .feed { padding: 16px; }
  .command-area { padding: 12px 16px 20px; }
  .topbar { padding: 12px 16px; }
  .receipt-metrics { flex-wrap: wrap; }
  .receipt-metric { min-width: 60px; }
  .receipt-action { flex-wrap: wrap; }
  .templates-grid, .template-group-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  #heroDemos { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .hero-demo-text { font-size: 0.78rem; }
  .feed-welcome { padding: 32px 16px 12px; }
  .feed-welcome h2 { font-size: 1.15rem; }
  .approval-btn { padding: 10px 18px; min-height: 44px; }
  .nav-item { padding: 12px 20px; min-height: 44px; }
  .command-send { padding: 12px 22px; min-height: 44px; }
  .voice-btn { min-width: 44px; min-height: 44px; }
  .receipt-btn { padding: 10px 16px; min-height: 44px; }
  .tpl-form-run { padding: 12px 28px; min-height: 44px; }
  .conn-bar { display: none; }
  .cmdk-overlay { padding-top: 40px; }
}

@media (max-width: 480px) {
  .templates-grid, .template-group-grid { grid-template-columns: 1fr; }
  #heroDemos { grid-template-columns: 1fr !important; gap: 8px; }
  .hero-demo { padding: 14px 16px; }
  .hero-demo-text { font-size: 0.72rem; }
  .feed-welcome h2 { font-size: 1rem; }
  .feed-welcome-logo { font-size: 1.6rem; }
  .feed-welcome-sub { font-size: 0.78rem; }
  .option-pros-cons { grid-template-columns: 1fr; }
  .brief-body { grid-template-columns: 1fr; }
  .receipt-action-details { padding-left: 12px; }
  .notif-panel { width:calc(100vw - 32px); right:-8px; }
  .template-tabs { gap:4px; }
  .template-tab { padding:4px 10px; font-size:0.62rem; }
  .command-send { font-size: 0.72rem; padding: 10px 16px; }
  .quick-chips { flex-wrap: wrap; }
  .quick-chip { font-size: 0.65rem; }
}
