/* ==========================================================================
   Internal Private Access - Ultra High-Security Design System
   Glassmorphism (Dark & Light) + Cyber Security Accents
   ========================================================================== */

:root {
  /* Default: Dark Glass Theme */
  --bg-base: #060913;
  --bg-gradient: radial-gradient(circle at 50% -20%, #111a33 0%, #060913 80%);
  --glass-surface: rgba(13, 20, 38, 0.65);
  --glass-surface-elevated: rgba(19, 30, 56, 0.85);
  --glass-surface-hover: rgba(26, 40, 74, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(6, 182, 212, 0.5);
  --glass-glow: 0 0 25px rgba(6, 182, 212, 0.25);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --editor-bg: rgba(7, 11, 22, 0.85);
  --line-numbers-color: #475569;
  --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  --glass-blur: blur(20px);
}

[data-theme="light"] {
  /* Light Glass Theme */
  --bg-base: #f0f4f8;
  --bg-gradient: radial-gradient(circle at 50% -20%, #e2e8f0 0%, #cbd5e1 80%);
  --glass-surface: rgba(255, 255, 255, 0.72);
  --glass-surface-elevated: rgba(255, 255, 255, 0.92);
  --glass-surface-hover: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-border-focus: rgba(37, 99, 235, 0.6);
  --glass-glow: 0 0 25px rgba(37, 99, 235, 0.15);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --accent-cyan: #0284c7;
  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --editor-bg: rgba(255, 255, 255, 0.9);
  --line-numbers-color: #94a3b8;
  --card-shadow: 0 20px 40px rgba(100, 116, 139, 0.15);
  --glass-blur: blur(20px);
}

/* Base resets & typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-base);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Cyber grid background decoration */
.cyber-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
}

[data-theme="light"] .cyber-grid-overlay {
  opacity: 0.08;
  background-image: 
    linear-gradient(to right, rgba(0, 0, 0, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
}

/* Glass panel components */
.glass-panel {
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
}

.glass-panel-elevated {
  background: var(--glass-surface-elevated);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

.glass-pill {
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 9999px;
  padding: 6px 14px;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

/* Monospace fonts */
.font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* High-tech security glow buttons */
.btn-cyber-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #ffffff;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-cyber-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(6, 182, 212, 0.5);
  filter: brightness(1.1);
}

.btn-cyber-primary:active {
  transform: translateY(0);
}

.btn-cyber-outline {
  background: var(--glass-surface);
  color: var(--text-main);
  font-weight: 500;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-cyber-outline:hover {
  background: var(--glass-surface-hover);
  border-color: var(--accent-cyan);
  color: var(--text-main);
  box-shadow: var(--glass-glow);
}

.btn-cyber-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: 10px;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-cyber-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: #f43f5e;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.3);
}

/* Glass Input & Form fields */
.glass-input {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  transition: all 0.2s ease;
}

.glass-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: var(--glass-glow);
  background: var(--glass-surface-elevated);
}

.glass-input::placeholder {
  color: var(--text-dim);
}

/* Badge components */
.badge-classified {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
}

.badge-military {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
}

.badge-danger {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}

/* View transitions */
.app-view {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  position: relative;
  z-index: 1;
}

.app-view.active-view {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Security Gate specific styling */
#view-security-gate {
  min-height: 100vh;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#view-security-gate.active-view {
  display: flex;
}

.gate-card {
  max-width: 780px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.gate-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple), var(--accent-emerald));
}

/* Auth view styling */
#view-auth {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#view-auth.active-view {
  display: flex;
}

.auth-card {
  max-width: 520px;
  width: 100%;
}

/* Main Dashboard layout */
#view-app {
  min-height: 100vh;
  display: none;
  flex-direction: column;
}

#view-app.active-view {
  display: flex;
}

.app-header {
  height: 68px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - 68px);
  overflow: hidden;
}

/* Sidebar / File Explorer */
.app-sidebar {
  width: 340px;
  min-width: 300px;
  max-width: 450px;
  border-right: 1px solid var(--glass-border);
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.tree-node-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  transition: all 0.15s ease;
  position: relative;
  color: var(--text-main);
}

.tree-node-item:hover {
  background: var(--glass-surface-hover);
}

.tree-node-item.active {
  background: rgba(6, 182, 212, 0.15);
  border-left: 3px solid var(--accent-cyan);
  font-weight: 600;
  color: var(--text-main);
}

[data-theme="light"] .tree-node-item.active {
  background: rgba(37, 99, 235, 0.12);
  border-left: 3px solid var(--accent-blue);
}

.tree-node-actions {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.tree-node-item:hover .tree-node-actions {
  display: flex;
}

.btn-tree-icon {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-tree-icon:hover {
  color: var(--text-main);
  background: var(--glass-surface-elevated);
}

/* Editor Main Area */
.app-editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--editor-bg);
  overflow: hidden;
  position: relative;
}

.editor-toolbar {
  height: 54px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.editor-wrapper {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.editor-line-numbers {
  width: 54px;
  background: rgba(0, 0, 0, 0.15);
  border-right: 1px solid var(--glass-border);
  color: var(--line-numbers-color);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  padding: 16px 8px;
  text-align: right;
  user-select: none;
  overflow: hidden;
}

[data-theme="light"] .editor-line-numbers {
  background: rgba(0, 0, 0, 0.03);
}

.editor-textarea {
  flex: 1;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.6;
  padding: 16px 20px;
  resize: none;
  white-space: pre;
  tab-size: 2;
  overflow-y: auto;
}

.editor-statusbar {
  height: 38px;
  border-top: 1px solid var(--glass-border);
  background: var(--glass-surface);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

/* Empty state / Welcome placeholder */
.editor-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  display: flex;
  opacity: 1;
}

.modal-card {
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-backdrop.open .modal-card {
  transform: scale(1);
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Inactivity Lock Screen */
#lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.95);
  backdrop-filter: blur(30px);
  z-index: 999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#lock-overlay.locked {
  display: flex;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--glass-surface-elevated);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color: var(--text-main);
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Hologram pulse animation */
@keyframes holoPulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

.holo-shield {
  animation: holoPulse 4s infinite ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .app-sidebar {
    width: 260px;
    min-width: 220px;
  }
}

@media (max-width: 680px) {
  .app-workspace {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    max-width: 100%;
    height: 240px;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }
}
