/* ══════════════════════════════════════
   css/styles.css — Tech Verse Editor
   All CSS in one place
══════════════════════════════════════ */

:root {
  --bg-main: #0d0f14;
  --bg-surface: #161921;
  --bg-surface-light: #1e2230;
  --bg-surface-hover: #252a3a;
  --primary: #5b8dee;
  --primary-glow: rgba(91,141,238,0.2);
  --primary-hover: #4070d4;
  --accent: #7c5cbf;
  --success: #10c98f;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-main: #e8eaf0;
  --text-muted: #6b7499;
  --text-dim: #3d4360;
  --border: #1f2435;
  --border-light: #2a3050;
  --sidebar-width: 300px;
  --font-code: 'Fira Code', 'Consolas', monospace;
  --font-size-editor: 15px;
  --radius: 8px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

/* ══ AUTH SCREEN — glass card over animated network background ══ */
#authScreen {
  position: fixed; inset: 0; z-index: 9000;
  background: radial-gradient(ellipse at 30% 20%, #10162b 0%, #090b14 55%, #05060b 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  overflow-y: auto; padding: 20px;
}
#authNetworkCanvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}

.auth-glow-1, .auth-glow-2, .auth-glow-3, .auth-glow-4 {
  position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
  filter: blur(10px);
}
.auth-glow-1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(91,141,238,0.22) 0%, transparent 70%);
  top: -120px; left: -100px; animation: float1 9s ease-in-out infinite;
}
.auth-glow-2 {
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(124,92,191,0.18) 0%, transparent 70%);
  bottom: -80px; right: -80px; animation: float2 11s ease-in-out infinite;
}
.auth-glow-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(16,201,143,0.16) 0%, transparent 70%);
  bottom: 10%; left: -60px; animation: float1 13s ease-in-out infinite;
}
.auth-glow-4 {
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(34,211,238,0.16) 0%, transparent 70%);
  top: 8%; right: -40px; animation: float2 10s ease-in-out infinite;
}
@keyframes float1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(30px,20px)} }
@keyframes float2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-20px,-30px)} }

.auth-card {
  background: rgba(20,23,36,0.16);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px; width: 100%; max-width: 400px;
  padding: 34px 32px 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(91,141,238,0.06);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  position: relative; z-index: 1;
  animation: cardIn 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
  /* ── Cap the card's height and scroll INSIDE it — prevents the
     "content pushed off-screen" issue that flex+align-items:center
     causes once the form is taller than the viewport ── */
  max-height: 94dvh; overflow-y: auto; overflow-x: hidden;
}
@keyframes cardIn { from{opacity:0;transform:translateY(30px) scale(0.96)} to{opacity:1;transform:none} }
.auth-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--accent), var(--success), transparent);
}

.auth-logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-logo-badge {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--primary);
  background: rgba(91,141,238,0.12); border: 1px solid rgba(91,141,238,0.25);
  flex-shrink: 0;
}
.auth-logo-text { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; color: var(--text-main); }
.auth-logo-sub  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.auth-tabs {
  display: flex; background: rgba(255,255,255,0.04);
  border-radius: 10px; padding: 4px; margin-bottom: 22px;
  border: 1px solid rgba(255,255,255,0.06);
}
.auth-tab {
  flex: 1; padding: 9px; text-align: center;
  font-size: 13px; font-weight: 600;
  border-radius: 7px; cursor: pointer;
  transition: var(--transition); color: var(--text-muted);
}
.auth-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; box-shadow: 0 4px 12px rgba(91,141,238,0.35);
}

.auth-form { display: none; flex-direction: column; gap: 14px; }
.auth-form.active { display: flex; }
.auth-title    { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 4px; color: var(--text-main); }
.auth-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.5; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.auth-input-wrap { position: relative; }
.auth-input-wrap i.field-icon {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: #8993a8; font-size: 14px; pointer-events: none;
}
.auth-input {
  width: 100%; padding: 14px 16px;
  background: #f4f6fb; border: 1px solid transparent;
  border-radius: 12px; color: #1a1f2e; font-size: 14.5px;
  font-family: 'Inter', sans-serif; outline: none; transition: var(--transition);
}
.auth-field:has(i.field-icon) .auth-input { padding-left: 38px; }
.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,141,238,0.25);
  background: #ffffff;
}
.auth-input::placeholder { color: #8993a8; }

.pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #8993a8;
  cursor: pointer; padding: 4px; border-radius: 4px; transition: var(--transition); font-size: 14px;
}
.pw-toggle:hover { color: var(--primary); }

.auth-forgot { text-align: right; margin-top: -6px; }
.auth-forgot a {
  font-size: 12px; color: var(--primary); text-decoration: none;
  font-weight: 500; transition: var(--transition);
}

.auth-btn {
  width: 100%; padding: 14px; border: none; border-radius: 999px; cursor: pointer;
  font-size: 14.5px; font-weight: 700; font-family: 'Inter', sans-serif;
  transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-btn-primary {
  background: linear-gradient(135deg, #2f7ff0 0%, #1f6feb 100%);
  color: white; box-shadow: 0 8px 22px rgba(47,127,240,0.4);
}
.auth-btn-primary:hover { opacity: 0.92; transform: translateY(-1px); }
.auth-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px; font-weight: 500;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1); }

.auth-btn-google {
  background: linear-gradient(135deg, #2266d3 0%, #1a56b8 100%);
  color: white; box-shadow: 0 8px 20px rgba(34,102,211,0.35);
}
.auth-btn-google:hover { opacity: 0.92; transform: translateY(-1px); }

.auth-btn-github {
  background: #14161d; border: 1px solid rgba(255,255,255,0.08);
  color: white; box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}
.auth-btn-github:hover { background: #1c1f28; transform: translateY(-1px); }
.auth-btn-github i.fa-github { font-size: 17px; }

.google-logo { width: 18px; height: 18px; }

.btn-spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.7s linear infinite; display: none;
}
.auth-btn.loading .btn-spinner { display: block; }
.auth-btn.loading .btn-label  { display: none; }

.auth-msg {
  border-radius: 9px; padding: 11px 14px; font-size: 13px; font-weight: 500;
  display: none; align-items: center; gap: 9px; line-height: 1.4;
}
.auth-msg.show  { display: flex; }
.auth-msg.error   { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #fca5a5; }
.auth-msg.success { background: rgba(16,201,143,0.1); border: 1px solid rgba(16,201,143,0.25); color: #6ee7b7; }
.auth-msg.info    { background: rgba(91,141,238,0.1); border: 1px solid rgba(91,141,238,0.25); color: #93c5fd; }

.auth-switch { text-align: center; font-size: 13px; color: var(--text-muted); }
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 600; }

.auth-bottom-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 13px; margin-top: 2px;
}
.auth-bottom-row a {
  color: #7ba8f5; text-decoration: underline; font-weight: 500;
}
.auth-bottom-row .auth-bottom-sep { color: var(--text-dim); }

.pw-strength { margin-top: 4px; }
.pw-strength-bar { height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.pw-strength-fill { height: 100%; border-radius: 3px; width: 0%; transition: width 0.4s, background 0.4s; }
.pw-strength-text { font-size: 10px; color: var(--text-muted); margin-top: 3px; }

.username-hint { font-size: 10.5px; color: var(--text-muted); margin-top: 5px; min-height: 13px; }
.username-hint.success { color: var(--success); }
.username-hint.error   { color: var(--danger); }

.auth-terms {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
}
.auth-terms input[type=checkbox] { margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }

/* ══ REGISTER — step-by-step wizard ══ */
.reg-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-bottom: 20px;
}
.reg-step-dot {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; color: var(--text-muted);
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  transition: var(--transition);
}
.reg-step-dot.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; border-color: transparent;
  box-shadow: 0 4px 12px rgba(91,141,238,0.35);
}
.reg-step-dot.done {
  background: rgba(16,201,143,0.15); border-color: rgba(16,201,143,0.4); color: var(--success);
}
.reg-step-dot.done span { display: none; }
.reg-step-dot.done::before { content: '\2713'; font-size: 12px; }
.reg-step-line { flex: 1; max-width: 28px; height: 2px; background: rgba(255,255,255,0.1); }

.reg-step-panel { display: none; flex-direction: column; gap: 14px; }
.reg-step-panel.active { display: flex; }
.reg-step-heading {
  font-size: 13px; font-weight: 600; color: var(--text-main); margin-bottom: -4px;
}
.reg-nav { display: flex; gap: 10px; }
.reg-nav .auth-btn { width: auto; flex: 1; }

.auth-btn-secondary {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main);
}
.auth-btn-secondary:hover { background: rgba(255,255,255,0.1); }

.reset-sent-state { text-align: center; padding: 10px 0; display: none; }
.reset-sent-state.show { display: block; }
.reset-sent-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(16,201,143,0.12); border: 2px solid rgba(16,201,143,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--success); margin: 0 auto 14px;
  animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes popIn { from{transform:scale(0);opacity:0} to{transform:scale(1);opacity:1} }
.reset-sent-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.reset-sent-text  { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ══ USER PILL & DROPDOWN ══ */
.user-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-surface-light); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px 4px 5px;
  cursor: pointer; transition: var(--transition); font-size: 12px;
}
.user-pill:hover { border-color: var(--primary); background: var(--primary-glow); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; flex-shrink: 0; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-dropdown {
  position: absolute; top: 56px; right: 14px;
  background: var(--bg-surface); border: 1px solid var(--border-light);
  border-radius: 12px; width: 220px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  z-index: 999; display: none; overflow: hidden;
  animation: dropIn 0.2s ease;
}
@keyframes dropIn { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:none} }
.user-dropdown.show { display: block; }
.user-dd-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--bg-surface-light), var(--bg-surface));
  text-align: center;
}
.user-dd-name  { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.user-dd-username { font-size: 11.5px; color: var(--primary); margin-bottom: 2px; }
.user-dd-email { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.user-dd-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white;
  margin: 0 auto 10px; overflow: hidden;
}
.user-dd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 13px; cursor: pointer; transition: var(--transition);
}
.user-dd-item:hover { background: var(--bg-surface-hover); }
.user-dd-item i { color: var(--text-muted); width: 14px; text-align: center; }
.user-dd-item.danger { color: var(--danger); }
.user-dd-item.danger i { color: var(--danger); }
.user-dd-sep { height: 1px; background: var(--border); }

/* ══ NAVBAR ══ */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; height: 52px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 16px rgba(0,0,0,0.4); z-index: 100; flex-shrink: 0; gap: 10px;
}
.nav-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn {
  font-size: 18px; color: var(--text-muted); cursor: pointer;
  background: none; border: none; padding: 6px; border-radius: 6px; transition: var(--transition);
}
.menu-btn:hover { color: var(--primary); background: var(--primary-glow); }
.file-path {
  font-size: 13.5px; font-weight: 500; color: var(--text-main);
  display: flex; align-items: center; gap: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-path .badge {
  background: var(--primary-glow); color: var(--primary);
  font-size: 10px; padding: 2px 7px; border-radius: 20px; border: 1px solid var(--primary); font-weight: 600;
}
.nav-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.icon-btn {
  color: var(--text-muted); font-size: 16px; cursor: pointer;
  background: none; border: none; padding: 7px 9px; border-radius: 6px;
  transition: var(--transition); position: relative;
}
.icon-btn:hover { color: var(--primary); background: var(--primary-glow); }
.icon-btn.run-btn { color: var(--success); }
.icon-btn.run-btn:hover { background: rgba(16,201,143,0.15); }
.autosave-dot {
  width: 6px; height: 6px; border-radius: 50%;
  position: absolute; top: 5px; right: 5px;
  background: var(--warning); display: none; animation: blink 1.2s infinite;
}
.autosave-dot.active { display: block; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ══ TAB BAR ══ */
.tab-bar {
  display: flex; align-items: center;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0; padding: 0 6px;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 12px; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap; transition: var(--transition); flex-shrink: 0; user-select: none;
}
.tab:hover { color: var(--text-main); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .close-tab {
  font-size: 10px; opacity: 0; margin-left: 2px; transition: opacity 0.2s; padding: 1px 3px; border-radius: 3px;
}
.tab:hover .close-tab { opacity: 0.7; }
.tab .close-tab:hover { opacity: 1; background: rgba(239,68,68,0.2); color: var(--danger); }
.tab-new-btn {
  color: var(--text-muted); font-size: 14px; padding: 8px 10px;
  cursor: pointer; flex-shrink: 0; transition: var(--transition); border-bottom: 2px solid transparent;
}
.tab-new-btn:hover { color: var(--primary); }

/* ══ SIDEBAR ══ */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 500; opacity: 0; visibility: hidden;
  backdrop-filter: blur(2px); transition: var(--transition);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }
.sidebar {
  position: fixed; top: 0; left: -105%; width: var(--sidebar-width);
  height: 100%; background: var(--bg-surface); z-index: 501;
  display: flex; flex-direction: column;
  box-shadow: 8px 0 32px rgba(0,0,0,0.5);
  transition: left 0.3s cubic-bezier(0.4,0,0.2,1); border-right: 1px solid var(--border);
}
.sidebar.active { left: 0; }

/* ── Drawer profile header (pattern bg + avatar), inspired by reference design ── */
.drawer-header {
  position: relative; overflow: hidden;
  padding: 30px 20px 22px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.025) 0 2px, transparent 2px 18px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.025) 0 2px, transparent 2px 18px),
    linear-gradient(135deg, #11141d, #060708);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: #fff; color: #11141d;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
.drawer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.drawer-title { font-size: 18px; font-weight: 700; color: #fff; margin-top: 14px; }
.drawer-name  { font-size: 12.5px; font-weight: 600; color: var(--text-main); margin-top: 6px; }
.drawer-username { font-size: 11px; color: var(--primary); margin-top: 1px; }
.drawer-email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.sidebar-panel { display: none; flex: 1; overflow-y: auto; }
.sidebar-panel.active { display: flex; flex-direction: column; }

/* ── Root drawer menu list ── */
.menu-scroll { flex: 1; overflow-y: auto; padding-bottom: 14px; }
.menu-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--text-dim);
  padding: 16px 18px 6px;
}
.menu-list { background: var(--bg-main); }
.menu-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; font-size: 13.5px; color: var(--text-main);
  cursor: pointer; transition: var(--transition); border-bottom: 1px solid var(--border);
}
.menu-list .menu-row:last-child { border-bottom: none; }
.menu-row:hover { background: var(--bg-surface-hover); }
.menu-row i:first-child { width: 18px; text-align: center; font-size: 15px; color: var(--primary); flex-shrink: 0; }
.menu-row span { flex: 1; }
.menu-row .chev { color: var(--text-dim); font-size: 11px; }
.menu-row.danger { margin-top: 10px; border-top: 1px solid var(--border); border-radius: 0; }
.menu-row.danger i:first-child { color: var(--danger); }
.menu-row.danger span { color: var(--danger); }
.menu-footer { text-align: center; font-size: 10.5px; color: var(--text-dim); padding: 18px 10px 6px; }

/* ── Sub-panel header bar with back button ── */
.subpanel-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; background: var(--bg-surface-light);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.subpanel-bar i { cursor: pointer; font-size: 14px; color: var(--text-muted); transition: var(--transition); }
.subpanel-bar i:hover { color: var(--primary); }
.subpanel-bar .title { font-size: 14.5px; font-weight: 700; color: var(--text-main); }

.explorer-toolbar { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.explorer-toolbar button {
  flex: 1; padding: 8px 6px; border: 1px solid var(--border);
  background: var(--bg-surface-light); color: var(--text-main);
  border-radius: 6px; font-size: 11px; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.explorer-toolbar button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }

.file-tree { list-style: none; padding: 8px 0; }
.tree-folder {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  color: var(--warning); cursor: pointer; user-select: none; transition: var(--transition);
}
.tree-folder:hover { background: rgba(245,158,11,0.08); }
.tree-folder i.fa-chevron-right { font-size: 9px; transition: transform 0.2s; margin-left: auto; color: var(--text-muted); }
.tree-folder.open i.fa-chevron-right { transform: rotate(90deg); }
.tree-file {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 36px; font-size: 12.5px; color: var(--text-main);
  cursor: pointer; transition: var(--transition); position: relative;
}
.tree-file:hover { background: var(--bg-surface-hover); }
.tree-file.active-file { background: var(--primary-glow); color: var(--primary); }
.tree-file::before { content: ''; position: absolute; left: 26px; top: 0; bottom: 0; width: 1px; background: var(--border); }
.tree-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-file-actions { display: none; gap: 4px; }
.tree-file:hover .tree-file-actions { display: flex; }
.tree-file-actions button {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 2px 5px; border-radius: 4px; font-size: 11px; transition: var(--transition);
}
.tree-file-actions button:hover { color: var(--danger); background: rgba(239,68,68,0.15); }
.tree-root-file { padding-left: 24px; }
.tree-root-file::before { left: 14px; }






/* ══ SETTINGS PANEL ══ */
.settings-section { border-bottom: 1px solid var(--border); padding: 16px; }
.settings-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--primary); margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}
.settings-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.settings-label { font-size: 13px; color: var(--text-main); }
.toggle-switch { position: relative; width: 42px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--bg-surface-light);
  border-radius: 24px; cursor: pointer; transition: 0.3s; border: 1px solid var(--border);
}
.toggle-slider::before {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-muted); top: 3px; left: 3px; transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); border-color: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); background: white; }
.range-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.range-label { font-size: 13px; color: var(--text-main); flex: 1; }
.range-val { font-size: 12px; color: var(--primary); font-weight: 600; min-width: 30px; text-align: right; }
input[type=range] {
  -webkit-appearance: none; width: 100%; height: 4px;
  background: var(--border-light); border-radius: 4px; outline: none; margin: 6px 0;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--primary); cursor: pointer;
}
.settings-select {
  background: var(--bg-main); border: 1px solid var(--border);
  color: var(--text-main); border-radius: 6px; padding: 7px 10px;
  font-size: 12px; outline: none; cursor: pointer;
}
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.theme-card {
  border: 2px solid var(--border); border-radius: 8px;
  padding: 8px 10px; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 8px;
}
.theme-card:hover, .theme-card.active { border-color: var(--primary); background: var(--primary-glow); }
.theme-card.active::after { content: '✓'; margin-left: auto; color: var(--primary); font-size: 12px; font-weight: 700; }
.theme-dots { display: flex; gap: 3px; }
.theme-dot { width: 10px; height: 10px; border-radius: 50%; }
.theme-name { font-size: 12px; font-weight: 500; }
.font-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.font-btn {
  padding: 6px 12px; border: 1px solid var(--border);
  background: var(--bg-surface-light); color: var(--text-main);
  border-radius: 6px; font-size: 12px; cursor: pointer; transition: var(--transition);
}
.font-btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }
.shortcut-list { margin-top: 8px; }
.shortcut-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.shortcut-item:last-child { border-bottom: none; }
.shortcut-key {
  background: var(--bg-surface-light); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 8px; font-family: var(--font-code);
  font-size: 11px; color: var(--primary);
}

/* ══ EDITOR ══ */
.editor-container { flex: 1; position: relative; overflow: hidden; }
.CodeMirror {
  height: 100% !important; font-family: var(--font-code) !important;
  font-size: var(--font-size-editor) !important;
  background: var(--bg-main) !important; line-height: 1.7 !important;
}
.CodeMirror-linenumber { color: var(--text-dim) !important; }
.CodeMirror-gutters    { background: var(--bg-main) !important; border-right: 1px solid var(--border) !important; }
.CodeMirror-cursor     { border-left: 2px solid var(--primary) !important; }
.CodeMirror-selected   { background: rgba(91,141,238,0.15) !important; }

/* ══ STATUS BAR ══ */
.statusbar {
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  height: 22px; display: flex; align-items: center;
  padding: 0 12px; font-size: 11px; color: rgba(255,255,255,0.9);
  font-family: var(--font-code); flex-shrink: 0; gap: 18px; overflow: hidden;
}
.statusbar-item { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.statusbar-sep  { width: 1px; height: 12px; background: rgba(255,255,255,0.3); }
.statusbar-right { margin-left: auto; }

/* ══ QUICK KEYBOARD ══ */
.quick-keyboard {
  background: var(--bg-surface); padding: 7px 10px;
  display: flex; gap: 6px; overflow-x: auto; white-space: nowrap;
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.quick-keyboard::-webkit-scrollbar { display: none; }
.key-btn {
  background: var(--bg-surface-light); color: var(--text-main);
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 13px;
  font-size: 13px; font-family: var(--font-code); cursor: pointer;
  transition: var(--transition); flex-shrink: 0; user-select: none;
}
.key-btn:active { background: var(--primary); border-color: var(--primary); color: white; transform: scale(0.95); }
.key-btn.special { color: var(--primary); border-color: rgba(91,141,238,0.3); }

/* ══ MODALS ══ */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  z-index: 2000; display: flex; justify-content: center; align-items: center;
  opacity: 0; visibility: hidden; transition: 0.2s; backdrop-filter: blur(4px);
}
.modal.active { opacity: 1; visibility: visible; }
.modal-content {
  background: var(--bg-surface); width: 340px; padding: 24px;
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  border: 1px solid var(--border); transform: translateY(-20px) scale(0.97); transition: 0.3s;
  /* ── Same fix as .auth-card: scroll inside the box instead of letting
     flex centering push the top of the content off-screen ── */
  max-height: 90vh; max-height: 90dvh; overflow-y: auto;
}
.modal.active .modal-content { transform: none; }
.modal h3 { font-size: 17px; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.modal h3 i { color: var(--primary); }
.modal-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.modal input, .modal select {
  width: 100%; padding: 11px 13px; margin-bottom: 14px;
  background: var(--bg-main); border: 1px solid var(--border);
  color: var(--text-main); border-radius: 8px; outline: none; font-size: 14px; transition: var(--transition);
}
.modal input:focus, .modal select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.btn-group { display: flex; gap: 10px; }
.btn { flex: 1; padding: 11px; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; transition: var(--transition); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-cancel { background: var(--bg-surface-light); color: var(--text-muted); border: 1px solid var(--border); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.btn-danger:hover { opacity: 0.9; }

/* ══ CUSTOM CONFIRM MODAL (replaces native browser confirm()) ══ */
.confirm-modal-content { text-align: center; width: 320px; }
.confirm-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  background: rgba(239,68,68,0.12); color: #ef4444;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.confirm-modal-content h3 { justify-content: center; margin-bottom: 10px; }
.confirm-message { font-size: 14px; color: var(--text-muted); line-height: 1.5; margin-bottom: 20px; }

.profile-avatar-section {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 20px; padding: 16px;
  background: var(--bg-surface-light); border-radius: 10px; border: 1px solid var(--border);
}
.profile-avatar-big {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: white; overflow: hidden;
  box-shadow: 0 6px 20px rgba(91,141,238,0.4);
}
.profile-avatar-big img { width: 100%; height: 100%; object-fit: cover; }
.profile-name-display  { font-size: 16px; font-weight: 700; }
.profile-email-display { font-size: 12px; color: var(--text-muted); }

/* ══ PREVIEW ══ */
.preview-overlay {
  position: fixed; inset: 0; background: #fff; z-index: 3000;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.preview-overlay.show { transform: none; }
.preview-header {
  background: #1a1a2e; color: #e0e0e0; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.preview-url {
  flex: 1; background: rgba(255,255,255,0.08); border-radius: 20px;
  padding: 6px 14px; font-size: 13px; font-family: var(--font-code);
  display: flex; align-items: center; gap: 7px;
}
.preview-url i { color: var(--success); font-size: 11px; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #555; margin-left: 2px; flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s;
}
.live-dot.on {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(80, 250, 123, 0.6);
  animation: liveDotPulse 1.8s ease-out infinite;
}
.live-dot.updating {
  background: #ffb454;
  box-shadow: 0 0 6px 2px rgba(255, 180, 84, 0.7);
  animation: none;
}
@keyframes liveDotPulse {
  0%   { box-shadow: 0 0 0 0 rgba(80, 250, 123, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(80, 250, 123, 0); }
  100% { box-shadow: 0 0 0 0 rgba(80, 250, 123, 0); }
}
.preview-close {
  background: none; border: none; color: #999; font-size: 20px;
  cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: var(--transition);
}
.preview-close:hover { color: var(--danger); }
.preview-frame { flex: 1; width: 100%; border: none; }

/* ══ SOURCE VIEW ══ */
.source-overlay {
  position: fixed; inset: 0; background: var(--bg-main); z-index: 3500;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.source-overlay.show { transform: none; }
.source-header {
  background: #1a1a2e; color: #e0e0e0; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.source-title { flex: 1; font-size: 13px; font-family: var(--font-code); display: flex; align-items: center; gap: 8px; }
.source-title i { color: var(--primary); }
.source-body {
  flex: 1; overflow: auto; padding: 20px;
  font-family: var(--font-code); font-size: 13px; line-height: 1.7;
  color: var(--text-main); white-space: pre-wrap; word-break: break-all;
}

/* ══ SEARCH BAR ══ */
.search-bar {
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  padding: 8px 12px; display: none; align-items: center; gap: 10px; flex-shrink: 0;
}
.search-bar.active { display: flex; }
.search-input {
  flex: 1; background: var(--bg-main); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 12px; color: var(--text-main); font-size: 13px; outline: none;
}
.search-input:focus { border-color: var(--primary); }
.search-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px 8px; border-radius: 5px; font-size: 13px; }
.search-btn:hover { color: var(--primary); }
.search-info { font-size: 11px; color: var(--text-muted); }

/* ══ CONTEXT MENU ══ */
.ctx-menu {
  position: fixed; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 0; z-index: 5000; min-width: 160px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: none;
}
.ctx-menu.show { display: block; }
.ctx-item {
  padding: 9px 16px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; transition: var(--transition);
}
.ctx-item:hover { background: var(--bg-surface-hover); }
.ctx-item.danger { color: var(--danger); }
.ctx-item i { width: 14px; text-align: center; color: var(--text-muted); }
.ctx-item.danger i { color: var(--danger); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ══ TOAST ══ */
.toast-container {
  position: fixed; bottom: 80px; right: 16px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.3s ease; max-width: 260px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--primary); }
@keyframes toast-in  { from{transform:translateX(120%);opacity:0} to{transform:none;opacity:1} }
@keyframes toast-out { from{opacity:1} to{transform:translateX(120%);opacity:0} }
.toast.out { animation: toast-out 0.3s ease forwards; }

/* ══ LOADING ══ */
.editor-loading {
  position: absolute; inset: 0; background: var(--bg-main);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px; z-index: 50;
}
.loader-ring {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg)} }
.loader-text { font-size: 13px; color: var(--text-muted); }
.empty-workspace { padding: 30px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.empty-workspace i { font-size: 40px; margin-bottom: 12px; opacity: 0.3; }

/* ══════════════════════════════════════
   PRO EDITOR PANEL
══════════════════════════════════════ */

/* Admin Bar */
.pro-admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(91,141,238,0.08);
  border: 1px solid rgba(91,141,238,0.2);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.pro-admin-badge {
  font-size: 11px;
  font-weight: 600;
  color: #5b8dee;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pro-admin-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pro-admin-btns button {
  background: rgba(91,141,238,0.15);
  border: 1px solid rgba(91,141,238,0.25);
  color: #c8d8ff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s;
}
.pro-admin-btns button:hover { background: rgba(91,141,238,0.3); }

/* Section */
.pro-section { margin-bottom: 20px; }
.pro-section-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Links Grid */
.pro-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pro-link-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: #c8d8ff;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s;
  overflow: hidden;
}
.pro-link-card:hover {
  background: rgba(91,141,238,0.12);
  border-color: rgba(91,141,238,0.3);
}

/* Posts */
.pro-post-card {
  position: relative;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}
.pro-post-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 8px;
}
.pro-post-body {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.pro-post-meta {
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  margin-top: 10px;
}

/* PDF */
.pro-pdf-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.pro-pdf-info { flex: 1; min-width: 0; }
.pro-pdf-name {
  font-size: 12px;
  font-weight: 600;
  color: #fca5a5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pro-pdf-size { font-size: 10px; color: rgba(255,255,255,0.3); }
.pro-pdf-open {
  color: rgba(255,255,255,0.4);
  font-size: 14px;
  text-decoration: none;
  padding: 4px 6px;
  transition: color 0.2s;
}
.pro-pdf-open:hover { color: #ef4444; }

/* Video */
.pro-video-card {
  position: relative;
  background: rgba(255,0,0,0.05);
  border: 1px solid rgba(255,0,0,0.12);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}
.pro-video-title {
  font-size: 12px;
  font-weight: 600;
  color: #fca5a5;
  padding: 10px 14px 8px;
}
.pro-video-card iframe {
  width: 100%;
  height: 180px;
  display: block;
}

/* Delete btn */
.pro-del-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(239,68,68,0.15);
  border: none;
  color: #ef4444;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}
.pro-link-card:hover .pro-del-btn,
.pro-post-card:hover .pro-del-btn,
.pro-pdf-card:hover .pro-del-btn,
.pro-video-card:hover .pro-del-btn { opacity: 1; }
.pro-del-btn:hover { background: rgba(239,68,68,0.35); }

/* Empty / Loading / Error */
.pro-empty, .pro-loading, .pro-error {
  text-align: center;
  padding: 20px;
  color: rgba(255,255,255,0.25);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pro-error { color: #ef4444; }

/* Upload Progress */
.pro-upload-progress { margin-bottom: 12px; }
.pro-progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.pro-progress-fill {
  height: 100%;
  background: #5b8dee;
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s;
}
.pro-progress-text {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-align: right;
}
