/* Global Dark Theme Fallback & Reset */
html, body {
  background-color: #0F141F !important;
  color: #f8fafc;
  min-height: 100vh;
  margin: 0 !important;
  padding: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  min-width: 100vw !important;
  display: block !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

/* Hard enforce hidden override */
.hidden {
  display: none !important;
}

/* Master full-width container enforcer */
#main-app-shell,
body > div.relative.z-10 {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  margin: 0 !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
  box-sizing: border-box !important;
  display: block !important;
}

header,
#panel-hotel-ops,
#card-sizing-toolbar,
#apps-grid,
#filter-bar,
#panel-metrics-summary,
#panel-hardware-telemetry,
#panel-tools-ribbon {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  box-sizing: border-box !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Custom Scrollbar for Sleek Dark Theme */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #0B0F17;
}
::-webkit-scrollbar-thumb {
  background: #1F2E47;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3B82F6;
}

/* Glassmorphism Card Hover Effects */
.app-card {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.app-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.5), 0 0 15px -3px rgba(59, 130, 246, 0.15);
}

/* Run / Off Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  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: #1F293D;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
  border: 1px solid #2B3D5B;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #94A3B8;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #10B981;
  border-color: #059669;
}
input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Glow status pills */
.glow-running {
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}
.glow-stopped {
  box-shadow: none;
}

/* Markdown Content Formatting for Chat Messages */
.chat-markdown p {
  margin-bottom: 0.5rem;
}
.chat-markdown p:last-child {
  margin-bottom: 0;
}
.chat-markdown h1, .chat-markdown h2, .chat-markdown h3, .chat-markdown h4 {
  font-weight: 700;
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
  color: #f8fafc;
}
.chat-markdown h1 { font-size: 1rem; }
.chat-markdown h2 { font-size: 0.95rem; }
.chat-markdown h3 { font-size: 0.9rem; }
.chat-markdown ul {
  list-style-type: disc;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.chat-markdown ol {
  list-style-type: decimal;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.chat-markdown li {
  margin-bottom: 0.2rem;
}
.chat-markdown pre {
  background-color: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.5rem;
  padding: 0.6rem 0.8rem;
  margin-top: 0.4rem;
  margin-bottom: 0.5rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  color: #e2e8f0;
}
.chat-markdown code {
  background-color: #1e293b;
  color: #38bdf8;
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
}
.chat-markdown pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
}
.chat-markdown blockquote {
  border-left: 3px solid #3b82f6;
  padding-left: 0.6rem;
  margin-left: 0;
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
  color: #94a3b8;
  font-style: italic;
}
.chat-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
}
.chat-markdown th, .chat-markdown td {
  border: 1px solid #334155;
  padding: 0.35rem 0.5rem;
  text-align: left;
}
.chat-markdown th {
  background-color: #1e293b;
  font-weight: 600;
  color: #f1f5f9;
}
.chat-markdown a {
  color: #60a5fa;
  text-decoration: underline;
}

/* Compact App Cards Mode */
body.compact-cards-mode .card-prompt-box {
  display: none !important;
}
body.compact-cards-mode .app-card {
  padding: 1.1rem !important;
}

/* Preset & Density Buttons Active States */
.layout-preset-btn,
.preset-btn {
  background-color: rgba(11, 15, 23, 0.7);
  border-color: #1F2E47;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.layout-preset-btn:hover,
.preset-btn:hover {
  border-color: rgba(99, 102, 241, 0.6);
  background-color: rgba(99, 102, 241, 0.12);
  transform: translateY(-1px);
}
.layout-preset-btn.active,
.preset-btn.active {
  border-color: #6366f1 !important;
  background-color: rgba(99, 102, 241, 0.25) !important;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3), inset 0 0 12px rgba(99, 102, 241, 0.15);
  outline: 2px solid rgba(99, 102, 241, 0.6);
  outline-offset: -1px;
}
.layout-preset-btn.active .preset-indicator,
.preset-btn.active .preset-indicator {
  background-color: #34d399 !important;
  box-shadow: 0 0 8px #34d399, 0 0 12px rgba(52, 211, 153, 0.6);
  border-color: #34d399 !important;
}

.density-btn {
  background-color: rgba(11, 15, 23, 0.7);
  border-color: #1F2E47;
  color: #94a3b8;
}
.density-btn:hover {
  border-color: rgba(99, 102, 241, 0.5);
  color: #f8fafc;
}
.density-btn.active {
  border-color: #6366f1 !important;
  background-color: rgba(99, 102, 241, 0.25) !important;
  color: #ffffff !important;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

/* ===================================================
   ↕️ Drag & Drop Reordering & Dynamic Sizing Classes
   =================================================== */
.app-card {
  min-height: var(--app-card-min-height, 320px);
}

.app-card.is-dragging {
  opacity: 0.4;
  transform: scale(0.97) rotate(-0.5deg);
  border: 2px dashed #6366f1 !important;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.35);
  cursor: grabbing !important;
}

.app-card.drag-over {
  border: 2px solid #38bdf8 !important;
  background-color: rgba(30, 58, 138, 0.35) !important;
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.25);
}

.drag-handle {
  cursor: grab;
  user-select: none;
}
.drag-handle:active {
  cursor: grabbing;
}

/* Density: Compact */
.density-compact .app-card {
  padding: 0.85rem !important;
  min-height: var(--app-card-min-height, 220px);
}
.density-compact .app-card .card-prompt-box {
  display: none !important;
}
.density-compact .app-card p {
  display: none !important;
}

/* Density: Standard */
.density-standard .app-card {
  padding: 1.25rem !important;
  min-height: var(--app-card-min-height, 320px);
}

/* Density: Spacious */
.density-spacious .app-card {
  padding: 1.6rem !important;
  min-height: var(--app-card-min-height, 420px);
}

/* ===================================================
   📱 Responsive Device Viewport Modes for Live Preview
   =================================================== */
#preview-viewport-container {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: #050811 !important;
  transition: all 0.3s ease;
}

#live-preview-iframe {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

#live-preview-iframe.viewport-desktop {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  border-radius: 0 !important;
  border: none !important;
}

#live-preview-iframe.viewport-tablet {
  width: 768px !important;
  max-width: 96% !important;
  height: calc(100% - 20px) !important;
  max-height: 95% !important;
  margin: 10px auto !important;
  border-radius: 18px !important;
  border: 4px solid #1e293b !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(99, 102, 241, 0.2) !important;
}

#live-preview-iframe.viewport-mobile {
  width: 390px !important;
  max-width: 90% !important;
  height: calc(100% - 20px) !important;
  max-height: 95% !important;
  margin: 10px auto !important;
  border-radius: 28px !important;
  border: 5px solid #1e293b !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(56, 189, 248, 0.25) !important;
}

/* ===================================================
   💬 Bandhu Chat Workstation: Minimal Bubbles & Controls
   =================================================== */

/* Minimal User Prompt Bubble */
.copilot-user-bubble {
  width: fit-content !important;
  min-width: 60px;
  word-break: break-word;
  white-space: normal !important;
  transition: all 0.2s ease;
}

/* Ultra-Compact Micro Action Buttons for User & Assistant Messages */
.copilot-micro-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  color: #94a3b8 !important;
  transition: all 0.15s ease !important;
}

.copilot-micro-btn:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.12) !important;
}

.copilot-micro-btn svg,
.copilot-micro-btn i {
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  min-height: 12px !important;
  stroke-width: 2.2 !important;
  display: block !important;
}

/* Assistant Message Markdown Prose Tweaks */
.copilot-markdown-body {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #e2e8f0;
}

.copilot-markdown-body p {
  margin-bottom: 0.5rem;
}
.copilot-markdown-body p:last-child {
  margin-bottom: 0;
}
.copilot-markdown-body pre {
  background-color: #0b0f17 !important;
  border: 1px solid #1f2e47 !important;
  border-radius: 8px !important;
  padding: 0.65rem 0.85rem !important;
  margin: 0.25rem 0 !important;
  font-size: 0.75rem !important;
  max-height: 240px;
  overflow: auto;
}
.copilot-markdown-body code {
  background-color: #1e293b;
  color: #38bdf8;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.75rem;
}
.copilot-markdown-body pre code {
  background-color: transparent !important;
  color: inherit !important;
  padding: 0 !important;
}
.copilot-code-collapse {
  transition: all 0.2s ease-in-out;
}
.copilot-code-collapse summary::-webkit-details-marker {
  display: none;
}

/* Full Chat Mode Optimal Width */
.copilot-full-width-container {
  max-width: 960px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  width: 100% !important;
}

/* Conversation Resumption Divider & Badge */
.copilot-resume-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0;
  position: relative;
}

.copilot-resume-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(45, 212, 191, 0.25) 30%, rgba(45, 212, 191, 0.25) 70%, transparent);
  pointer-events: none;
}

.copilot-resume-badge {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  background: #090e17;
  border: 1px solid rgba(45, 212, 191, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ===== UX UPGRADE v2.0 — Senior Mobile Design System ===== */

/* Glow running — stronger emerald card ring */
.glow-running {
  text-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

/* App card running state — subtle green ring */
.app-card:has(.glow-running) {
  box-shadow: 0 0 0 1.5px rgba(52, 211, 153, 0.2), 0 8px 32px rgba(52, 211, 153, 0.08);
}

/* Active:scale-95 tap feedback on all card action buttons */
.app-card button:not([disabled]):not(.switch input),
.app-card a[href] {
  transition: transform 75ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.app-card button:not([disabled]):active,
.app-card a[href]:active {
  transform: scale(0.95);
}

/* Switch toggle — slightly larger for thumb zone */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151;
  border-radius: 24px;
  transition: 0.25s;
}
.slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #94a3b8;
  border-radius: 50%;
  transition: 0.25s;
}
input:checked + .slider {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}
input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

/* Metrics card — urgency pulse ring when active > 0 */
#metric-active-count {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

/* System Score gradient bar */
#metric-system-bar {
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* All Operational banner */
#all-operational-banner {
  animation: slideDownFade 0.4s ease;
}
@keyframes slideDownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Touch-safe minimum sizes for icon buttons */
.app-card button[title] {
  min-width: 36px;
  min-height: 36px;
}
