/* SMARTSEC Shared UI Styles */
:root {
  --help-bg: rgba(10, 20, 35, 0.95);
  --help-border: rgba(0, 212, 255, 0.3);
  --help-accent: #00d4ff;
  --help-text: #e0e0e0;
  --glass-bg: rgba(255, 255, 255, 0.05);
}

/* Global Help Modal */
.help-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.help-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.help-modal {
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  background: var(--help-bg);
  border: 1px solid var(--help-border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 212, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.help-modal-overlay.active .help-modal {
  transform: translateY(0);
}

.help-header {
  padding: 20px 25px;
  background: rgba(0, 212, 255, 0.1);
  border-bottom: 1px solid var(--help-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.help-header h2 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--help-accent);
  display: flex;
  align-items: center;
  gap: 12px;
}

.help-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.help-close:hover {
  opacity: 1;
  color: #ff4757;
}

.help-body {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 30px;
}

.help-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-nav-btn {
  padding: 12px 15px;
  background: var(--glass-bg);
  border: 1px solid transparent;
  border-radius: 8px;
  color: #ccc;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.help-nav-btn:hover {
  background: rgba(0, 212, 255, 0.1);
  color: #fff;
}

.help-nav-btn.active {
  background: rgba(0, 212, 255, 0.2);
  border-color: var(--help-accent);
  color: var(--help-accent);
  font-weight: 600;
}

.help-content {
  color: var(--help-text);
  line-height: 1.6;
}

.help-content h3 {
  color: #fff;
  margin-top: 0;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.help-section {
  display: none;
}

.help-section.active {
  display: block;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
}

.shortcut-key {
  background: #333;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--help-accent);
  border: 1px solid #444;
}

.help-footer {
  padding: 15px 25px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  color: #888;
  text-align: center;
}

/* Global Help Trigger Button (Floating or Nav) */
.nav-help-btn {
  color: #ff9f43 !important;
  font-weight: bold !important;
  cursor: pointer;
}

.nav-help-btn i {
  margin-right: 5px;
}

/* Global Professional Toolbox */
.toolbox-fab {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #00d4ff, #0056b3);
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  cursor: pointer;
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.toolbox-fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6);
}

.toolbox-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.toolbox-modal-overlay.active {
  display: flex;
}

.toolbox-window {
  width: 400px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease-out;
}

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

.toolbox-header {
  padding: 12px 15px;
  background: #252525;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toolbox-header h4 {
  margin: 0;
  color: #00d4ff;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbox-grid-view {
  display: flex;
  flex-direction: column;
}

.toolbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 15px;
}

.toolbox-item {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 15px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.toolbox-item:hover {
  background: #333;
  border-color: #00d4ff;
  transform: translateY(-2px);
}

.toolbox-item i {
  font-size: 20px;
  color: #00d4ff;
}

.toolbox-item span {
  font-size: 10px;
  color: #ccc;
  text-align: center;
  font-weight: 600;
}

.toolbox-tool-view {
  display: none;
  padding: 15px;
  background: #111;
  min-height: 250px;
}

.toolbox-tool-view.active {
  display: block;
}

.toolbox-back-btn {
  background: none;
  border: none;
  color: #00d4ff;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: bold;
}

.toolbox-back-btn:hover {
  text-decoration: underline;
}

.tool-input-group {
  margin-bottom: 15px;
}

.tool-input-group label {
  display: block;
  font-size: 11px;
  color: #aaa;
  margin-bottom: 5px;
}

.tool-input-group input, .tool-input-group select, .tool-input-group textarea {
  width: 100%;
  background: #222;
  border: 1px solid #444;
  color: #fff;
  padding: 8px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}

.tool-input-group input:focus {
  border-color: #00d4ff;
}

.tool-action-btn {
  width: 100%;
  background: #00d4ff;
  color: #000;
  border: none;
  padding: 10px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.tool-action-btn:hover {
  background: #00b8e6;
}

.tool-result-area {
  margin-top: 15px;
  padding: 10px;
  background: #000;
  border: 1px solid #333;
  border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  color: #00ff00;
  white-space: pre-wrap;
  min-height: 60px;
  max-height: 200px;
  overflow-y: auto;
}

/* ─── DYNAMIC THEME SYSTEM ─── */
.theme-toggle-btn {
  position: fixed;
  bottom: 25px;
  right: 95px;
  width: 56px;
  height: 56px;
  background: #101524;
  border: 2px solid rgba(0, 212, 255, 0.3);
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 10px rgba(0, 212, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffd60a;
  font-size: 20px;
  cursor: pointer;
  z-index: 99999;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-toggle-btn:hover {
  transform: scale(1.1) rotate(45deg);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.5);
  border-color: #00d4ff;
}

/* Universal Cool Slate Light Theme Overrides */
body.light-theme {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --bg4: #e2e8f0;
  --bg5: #f8fafc;
  --t: #1e293b;
  --t2: #475569;
  --t3: #64748b;
  --bd: rgba(14, 165, 233, 0.2);
  --bd2: rgba(0, 0, 0, 0.06);
  --bd3: rgba(14, 165, 233, 0.4);
  
  /* Login specific colors */
  --surface: rgba(255, 255, 255, 0.95);
  --border: rgba(14, 165, 233, 0.3);
  --text: #1e293b;
  --muted: #64748b;
  
  background: #f1f5f9 !important;
  color: #1e293b !important;
}

/* Light Theme Component Overrides */
body.light-theme .theme-toggle-btn {
  background: #ffffff;
  border-color: rgba(14, 165, 233, 0.3);
  color: #7c3aed;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.2);
}

body.light-theme .theme-toggle-btn:hover {
  border-color: #7c3aed;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

body.light-theme .topbar,
body.light-theme .header,
body.light-theme .top-nav {
  background: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid rgba(14, 165, 233, 0.2) !important;
  backdrop-filter: blur(20px) !important;
}

body.light-theme .tb-a, 
body.light-theme .nav-link {
  color: #475569 !important;
}

body.light-theme .tb-a:hover,
body.light-theme .nav-link:hover {
  background: rgba(14, 165, 233, 0.08) !important;
  color: #0ea5e9 !important;
}

body.light-theme .tb-a.on,
body.light-theme .nav-link.active {
  background: rgba(14, 165, 233, 0.12) !important;
  color: #0ea5e9 !important;
  border: 1px solid rgba(14, 165, 233, 0.25) !important;
}

body.light-theme .sidebar {
  background: rgba(255, 255, 255, 0.9) !important;
  border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .sidebar-section,
body.light-theme .sb-hd {
  color: #64748b !important;
}

body.light-theme .sb-link,
body.light-theme .sb-l {
  color: #475569 !important;
}

body.light-theme .sb-link:hover,
body.light-theme .sb-l:hover {
  background: rgba(14, 165, 233, 0.08) !important;
  color: #0ea5e9 !important;
}

body.light-theme .sb-link.active,
body.light-theme .sb-l.on {
  background: rgba(14, 165, 233, 0.12) !important;
  color: #0ea5e9 !important;
  border-left-color: #0ea5e9 !important;
}

body.light-theme .card,
body.light-theme .kpi,
body.light-theme .category-card,
body.light-theme .room-card,
body.light-theme .progress-section,
body.light-theme .leaderboard,
body.light-theme .toolbox-window,
body.light-theme .control-panel,
body.light-theme .sys-item {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: #1e293b !important;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.02) !important;
}

body.light-theme .ch,
body.light-theme .card-hdr,
body.light-theme .room-header,
body.light-theme .toolbox-header,
body.light-theme .panel-header {
  background: #f8fafc !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .cb, 
body.light-theme .cb0,
body.light-theme .card-body,
body.light-theme .room-description,
body.light-theme .leaderboard-table td,
body.light-theme .progress-message,
body.light-theme .panel-title,
body.light-theme .section-title,
body.light-theme .device-item {
  color: #334155 !important;
}

body.light-theme .tbl th,
body.light-theme thead th,
body.light-theme .leaderboard-table th {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .tbl td,
body.light-theme tbody td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .tf-item,
body.light-theme .log-item,
body.light-theme .cred-row {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .tf-title,
body.light-theme .category-title,
body.light-theme .room-title,
body.light-theme .stat-val,
body.light-theme .pg-title,
body.light-theme .card-hdr-title,
body.light-theme .u-name,
body.light-theme .cred-device {
  color: #0f172a !important;
}

body.light-theme .tf-desc,
body.light-theme .category-desc,
body.light-theme .room-description p,
body.light-theme .page-subtitle,
body.light-theme .stat-lbl,
body.light-theme .pg-sub,
body.light-theme .u-email,
body.light-theme .cred-note,
body.light-theme .sidebar-footer {
  color: #64748b !important;
}

body.light-theme .tb-time,
body.light-theme .ch-sub,
body.light-theme .peer-det,
body.light-theme .room-info {
  color: #64748b !important;
}

body.light-theme .term-box,
body.light-theme .flog,
body.light-theme .tool-result-area,
body.light-theme .websocket-terminal,
body.light-theme .terminal-output,
body.light-theme .progress-container,
body.light-theme .network-canvas-container {
  background: #0f172a !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(255,255,255,0.05) !important;
}

body.light-theme .tool {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .tool-nm {
  color: #0f172a !important;
}

body.light-theme .tool-ds {
  color: #475569 !important;
}

body.light-theme .toolbox-item {
  background: #f8fafc !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .toolbox-item:hover {
  background: #f1f5f9 !important;
  border-color: #0ea5e9 !important;
}

body.light-theme .toolbox-item span {
  color: #475569 !important;
}

body.light-theme .tool-input-group input,
body.light-theme .tool-input-group select,
body.light-theme .tool-input-group textarea {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}

body.light-theme .tool-input-group input:focus {
  border-color: #0ea5e9 !important;
}

body.light-theme .bg-grid {
  background-image:
    linear-gradient(rgba(14,165,233,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14,165,233,.07) 1px, transparent 1px) !important;
}

body.light-theme .bg-glow {
  background: radial-gradient(circle, rgba(14,165,233,.12) 0%, transparent 70%) !important;
}

body.light-theme .sys-item-val {
  color: #0f172a !important;
}

body.light-theme .btn-sm {
  background: #f1f5f9 !important;
  border-color: rgba(0,0,0,0.08) !important;
  color: #334155 !important;
}

body.light-theme .btn-sm:hover {
  border-color: #0ea5e9 !important;
  color: #0ea5e9 !important;
}

/* ─── GLOBAL MOBILE RESPONSIVENESS OVERRIDES ─── */
@media (max-width: 768px) {
  /* Layout Structures */
  body {
    height: auto !important;
    overflow-y: auto !important;
  }
  
  .shell {
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  .sidebar {
    display: none !important; /* Hide sidebars in dashboards/consoles as mobile users use main tools/menus */
  }
  
  .main, .page {
    padding: 14px 10px !important;
    height: auto !important;
    overflow-y: visible !important;
  }
  
  /* Top Navigation Bars (Dynamic Swipe Menus) */
  .topbar, .header, #pt-topnav {
    height: auto !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 10px 14px !important;
    gap: 8px !important;
    position: relative !important;
  }
  
  body, body[style*="padding-top"] {
    padding-top: 0 !important;
  }
  
  .tb-logo, .logo, .pt-logo {
    margin-right: 0 !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 1.1rem !important;
  }
  
  .tb-nav, .nav-links, #pt-topnav .ptnav {
    display: flex !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding: 2px 4px 6px !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 8px !important;
    scrollbar-width: none !important;
  }
  
  .tb-nav::-webkit-scrollbar, 
  .nav-links::-webkit-scrollbar,
  #pt-topnav::-webkit-scrollbar {
    display: none !important;
  }
  
  .tb-a, .nav-link, .ptnav {
    flex: 0 0 auto !important;
    font-size: 0.76rem !important;
    padding: 6px 10px !important;
  }
  
  .tb-right, .user-section {
    width: 100% !important;
    margin-left: 0 !important;
    justify-content: space-between !important;
    padding-top: 4px !important;
    border-top: 1px dashed var(--bd2) !important;
  }
  
  /* Grids & Cards */
  .kpi-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  
  .kpi-row .kpi:last-child {
    grid-column: span 2 !important;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  
  .g2, .g3, .g2a, .m-grid, .stats-row, .tools-g {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  
  .tbl-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .tbl, table {
    min-width: 500px !important;
  }
  
  /* Modals & Dialogs */
  .modal, .toolbox-window, .modal-box {
    width: 95% !important;
    max-height: 85vh !important;
    padding: 16px !important;
    overflow-y: auto !important;
  }
  
  .m-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }
  
  .m-actions button, .modal-footer button {
    width: 100% !important;
    margin-left: 0 !important;
  }
  
  /* Packet Tracer Mobile Overrides */
  #menubar {
    height: auto !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 6px !important;
    gap: 6px !important;
  }
  
  #logo-area {
    display: none !important;
  }
  
  #menu-items {
    justify-content: center !important;
  }
  
  #menu-right {
    margin-left: 0 !important;
    justify-content: center !important;
  }
  
  #toolbar {
    height: auto !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    display: flex !important;
    flex-direction: row !important;
    padding: 6px !important;
    gap: 6px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  
  #toolbar::-webkit-scrollbar {
    display: none !important;
  }
  
  .tool-group {
    display: flex !important;
    flex-shrink: 0 !important;
  }
  
  .toolbar-sep {
    height: 18px !important;
    width: 1px !important;
    margin: 0 4px !important;
  }
  
  #main-layout {
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  #device-panel {
    width: 100% !important;
    height: 140px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--bd) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  #device-categories {
    flex-direction: row !important;
    overflow-x: auto !important;
    height: 52px !important;
    padding: 4px !important;
    gap: 6px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  
  #device-categories::-webkit-scrollbar {
    display: none !important;
  }
  
  .cat-btn {
    width: auto !important;
    padding: 4px 10px !important;
    flex-direction: row !important;
    gap: 4px !important;
    white-space: nowrap !important;
  }
  
  .cat-btn img {
    width: 16px !important;
    height: 16px !important;
  }
  
  #device-list {
    flex-direction: row !important;
    overflow-x: auto !important;
    padding: 6px !important;
    gap: 6px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  
  #device-list::-webkit-scrollbar {
    display: none !important;
  }
  
  .device-item {
    width: auto !important;
    min-width: 80px !important;
    padding: 6px !important;
    white-space: nowrap !important;
  }
  
  #canvas-wrapper {
    flex: none !important;
    width: 100% !important;
    height: 320px !important;
    overflow: auto !important;
  }
  
  #topology-canvas {
    min-width: 800px !important; /* Keep active canvas swipeable to support device manipulation */
    min-height: 500px !important;
  }
  
  #right-panel {
    width: 100% !important;
    height: 250px !important;
    border-left: none !important;
    border-top: 1px solid var(--bd) !important;
  }
  
  #statusbar {
    position: relative !important;
    flex-wrap: wrap !important;
    height: auto !important;
    padding: 6px 10px !important;
    gap: 6px !important;
  }
  
  /* Floating Toggle buttons placement on mobile */
  .theme-toggle-btn {
    bottom: 16px !important;
    right: 80px !important;
    width: 48px !important;
    height: 48px !important;
  }
  
  .toolbox-fab {
    bottom: 16px !important;
    right: 16px !important;
    width: 48px !important;
    height: 48px !important;
  }
}
