/* Modern Style System for Security Suite - Plotter v2 / Flowchart Style */

:root {
  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Transitions */
  --transition-fast: 0.12s ease;
  --transition-normal: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Light Theme Variables */
  --bg-color: #f6f6f7;
  --panel-bg: #ffffff;
  --panel-border: #e2e2e5;
  --text-primary: #1c1c1e;
  --text-secondary: #6e6e73;
  --text-muted: #aeaeb2;
  --accent-color: #000000;
  --accent-hover: #262626;
  --accent-bg-subtle: #f2f2f7;
  --grid-dot: #e2e2e5;
  --input-focus-ring: rgba(0, 0, 0, 0.05);
  --card-bg: #ffffff;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  /* Dark Theme Variables */
  --bg-color: #0d0d0f;
  --panel-bg: #1a1a1e;
  --panel-border: #2c2c2e;
  --text-primary: #f5f5f7;
  --text-secondary: #8e8e93;
  --text-muted: #48484a;
  --accent-color: #ffffff;
  --accent-hover: #d1d1d6;
  --accent-bg-subtle: #2c2c2e;
  --grid-dot: #222225;
  --input-focus-ring: rgba(255, 255, 255, 0.05);
  --card-bg: #222228;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* Left Toolbar Dock */
.left-toolbar {
  width: 56px;
  height: 100%;
  background-color: var(--panel-bg);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 12px;
  z-index: 10;
  flex-shrink: 0;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.toolbar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.toolbar-divider {
  width: 24px;
  height: 1px;
  background-color: var(--panel-border);
  margin: 4px 0;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--accent-color);
}

.logo-icon svg {
  width: 22px;
  height: 22px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all var(--transition-fast);
  padding: 0;
}

.tool-btn svg {
  width: 18px;
  height: 18px;
}

.tool-btn:hover:not(:disabled) {
  background-color: var(--accent-bg-subtle);
  color: var(--text-primary);
}

/* Tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: auto;
  left: 125%;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background-color: var(--text-primary);
  color: var(--panel-bg);
  font-size: 10px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  z-index: 100;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--panel-border);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Main Canvas Viewport */
.canvas-container {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.canvas-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-color);
  background-image: radial-gradient(var(--grid-dot) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  z-index: 1;
}

.canvas-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#preview-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 40px;
}

.workspace-card {
  background-color: var(--card-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* Captcha Canvas Canvas */
#captcha-canvas {
  border: 1px solid var(--panel-border);
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: block;
}

.verify-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.verify-box label {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.verify-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.verify-row .text-input {
  flex: 1;
}

.verify-row button {
  width: 80px;
}

.verify-result {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  margin-top: 4px;
  min-height: 18px;
}

.verify-result.success {
  color: #34c759;
}

.verify-result.error {
  color: #ff3b30;
}

/* XOR Cipher boxes */
.cipher-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cipher-box label {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.cipher-box textarea {
  resize: none;
  height: 120px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Floating HUD status bar */
.hud-status-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  z-index: 5;
}

.hud-item {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

.hud-divider {
  color: var(--panel-border);
  font-size: 10px;
}

/* Right Sidebar Inspector */
.right-sidebar {
  width: 320px;
  height: 100%;
  background-color: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

/* Sidebar Tab Headers */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--panel-border);
  background-color: var(--panel-bg);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 14px 2px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.tab-btn svg {
  width: 14px;
  height: 14px;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}

/* Tab Contents */
.sidebar-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.sidebar-tab-content::-webkit-scrollbar {
  width: 5px;
}
.sidebar-tab-content::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-tab-content::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 3px;
}

.sidebar-tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Section Title */
.input-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 6px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-field-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field-wrapper label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.text-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  background-color: var(--accent-bg-subtle);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.text-input:focus {
  border-color: var(--text-primary);
  background-color: var(--panel-bg);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

select.text-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
}

textarea.text-input {
  resize: vertical;
}

/* Buttons */
.action-btn {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--accent-color);
  color: var(--panel-bg);
  border: 1px solid var(--accent-color);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Toast Notification styling */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--text-primary);
  color: var(--panel-bg);
  font-size: 12px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 30px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.app-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Floating Navigation Pill ── */
.nav-pill {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 30px;
  padding: 5px 8px 5px 12px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal, 0.22s);
  opacity: 0.75;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.nav-pill:hover {
  opacity: 1;
  box-shadow: var(--shadow-lg);
}

.nav-pill-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-pill-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: none;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.nav-pill-btn svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.nav-pill-btn.back-hub {
  background-color: var(--accent-bg-subtle);
  color: var(--text-primary);
}

.nav-pill-btn.back-hub:hover {
  background-color: var(--text-primary);
  color: var(--panel-bg);
}

.nav-pill-btn.open-standalone {
  background-color: var(--accent-color);
  color: var(--panel-bg);
}

.nav-pill-btn.open-standalone:hover {
  background-color: var(--accent-hover);
}

/* ── Mobile Toggle Buttons ── */
.mobile-toggle-btn {
  display: none;
  position: absolute;
  top: 16px;
  z-index: 99;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-toggle-btn:hover {
  background-color: var(--accent-bg-subtle);
}

.mobile-toggle-btn.left-toggle {
  left: 16px;
}

.mobile-toggle-btn.right-toggle {
  right: 16px;
}

.sidebar-overlay {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 90;
}

/* ── Responsive breakpoints ── */
@media (max-width: 768px) {
  .mobile-toggle-btn {
    display: flex;
  }

  .left-toolbar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: none;
  }

  .left-toolbar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .right-sidebar {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    transform: translateX(100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: none;
  }

  .right-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .nav-pill {
    top: 10px;
    left: auto;
    right: 10px;
    transform: none;
    padding: 4px 6px 4px 8px;
  }

  .nav-pill-label {
    display: none;
  }

  .nav-pill-btn {
    font-size: 10px;
    padding: 4px 8px;
  }
}
