/* ===== ROOT DESIGN SYSTEM ===== */
:root {
  --bg: #0a0b12;
  --surface: #111220;
  --surface-2: #181a2a;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.09);
  --accent: #7c6ef5;
  --accent-2: #22c55e;
  --accent-3: #f59e0b;
  --danger: #ef4444;
  --text: #e8eaf6;
  --text-muted: #7b7fa3;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background orbs */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: float 12s ease-in-out infinite;
}
.orb-1 { width: 600px; height: 600px; background: var(--accent); top: -200px; left: -200px; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: #22d3ee; bottom: -100px; right: -100px; animation-delay: -4s; }
.orb-3 { width: 300px; height: 300px; background: var(--accent-2); top: 50%; left: 50%; animation-delay: -8s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ===== APP CONTAINER ===== */
.app-container {
  position: relative; z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ===== HEADER ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 20px rgba(124, 110, 245, 0.6));
}
.header-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-logo p { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
.header-badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: var(--accent-2);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ===== TABS ===== */
.main-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 1.5rem;
}
.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.tab-btn:hover { color: var(--text); background: var(--glass); }
.tab-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 15px rgba(124, 110, 245, 0.4);
}
.tab-icon { font-size: 1.1rem; }

/* Sub tabs */
.sub-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.sub-tab-btn {
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.sub-tab-btn:hover { color: var(--text); border-color: var(--accent); }
.sub-tab-btn.active {
  background: rgba(124, 110, 245, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== PANELS ===== */
.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }
.sub-panel { display: none; animation: fadeIn 0.3s ease; }
.sub-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== GLASS PANEL ===== */
.glass-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}
@media (max-width: 680px) { .panel-grid, .steg-grid { grid-template-columns: 1fr; } }

.steg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}

/* ===== FORM FIELDS ===== */
.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}
.field-textarea, .field-input {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  padding: 0.75rem 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}
.field-textarea { line-height: 1.6; }
.field-textarea:focus, .field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 110, 245, 0.15);
}
.field-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.algo-badge {
  background: rgba(124, 110, 245, 0.15);
  border: 1px solid rgba(124, 110, 245, 0.3);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Password wrap */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrap .field-input { padding-right: 3rem; }
.toggle-pw-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.5;
  transition: opacity var(--transition);
}
.toggle-pw-btn:hover { opacity: 1; }

/* Password strength */
.strength-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}
.strength-bar {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 0.4s ease, background 0.4s ease;
}
.strength-label { font-size: 0.75rem; font-weight: 600; min-width: 60px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5b52e0);
  color: #fff;
  box-shadow: 0 4px 15px rgba(124,110,245,0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124,110,245,0.5);
}
.btn-accent {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 4px 15px rgba(34,197,94,0.3);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(34,197,94,0.45);
}
.btn-full { width: 100%; margin-top: 1.2rem; }

/* ===== OUTPUT BOX ===== */
.output-box {
  position: relative;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 1.2rem;
}
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.2rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--glass-border);
}
.output-label { font-size: 0.85rem; font-weight: 600; }
.output-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 1.2rem;
  word-break: break-all;
  white-space: pre-wrap;
  color: #a5f3fc;
  max-height: 200px;
  overflow-y: auto;
}
.copy-btn {
  background: rgba(124, 110, 245, 0.15);
  border: 1px solid rgba(124, 110, 245, 0.3);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.copy-btn:hover { background: var(--accent); color: #fff; }
.copy-btn.copied { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

.success-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.2rem;
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.25);
  color: #a7f3d0;
}

/* Error box */
.error-box {
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-size: 0.88rem;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ===== DROPZONE ===== */
.dropzone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--glass);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(124,110,245,0.07);
  transform: scale(1.01);
}
.drop-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.dropzone p { color: var(--text-muted); font-size: 0.88rem; }
.drop-sub { font-size: 0.75rem !important; margin-top: 0.3rem; }

/* Image preview */
.image-preview-wrap {
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--glass-border);
}
.image-preview-wrap img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: #000;
  display: block;
}
.image-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.3);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.capacity-info strong { color: var(--accent-2); }

/* Progress bar */
.progress-wrap {
  margin-top: 1.2rem;
  text-align: center;
}
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22d3ee);
  border-radius: 999px;
  width: 0%;
  transition: width 0.1s linear;
}
#hide-progress-label { font-size: 0.78rem; color: var(--text-muted); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 999;
  transition: all 0.3s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(20px); }

/* ===== FOOTER ===== */
.app-footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.6;
  padding: 1.5rem;
  border-top: 1px solid var(--glass-border);
}
.app-footer strong { color: var(--accent-2); }

/* Masked textarea uses -webkit-text-security for Chrome/Safari, JS fallback for others */
.masked-textarea {
  -webkit-text-security: disc;
}
.masked-textarea.revealed {
  -webkit-text-security: none;
}

.toggle-msg-btn {
  background: rgba(124, 110, 245, 0.12);
  border: 1px solid rgba(124, 110, 245, 0.25);
  color: var(--accent);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.toggle-msg-btn:hover { background: var(--accent); color: #fff; }

/* ===== PASSWORD GENERATOR ===== */
.passgen-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  align-items: start;
}
@media (max-width: 720px) { .passgen-layout { grid-template-columns: 1fr; } }

/* Charset checkboxes */
.charset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.charset-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
}
.charset-check input[type="checkbox"] { display: none; }
.check-box {
  width: 20px; height: 20px;
  border: 2px solid var(--glass-border);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  background: rgba(0,0,0,0.2);
}
.charset-check input:checked + .check-box {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(124,110,245,0.4);
}
.charset-check input:checked + .check-box::after {
  content: '✓';
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}
.check-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  display: flex; flex-direction: column; gap: 1px;
}
.check-sub { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }

/* Password output */
.pg-output-box {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition);
  position: relative;
  overflow: hidden;
}
.pg-output-box:hover { border-color: var(--accent); }
.pg-output-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124,110,245,0.05), transparent);
  pointer-events: none;
}
.pg-output-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 500;
  color: #a5f3fc;
  word-break: break-all;
  text-align: center;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

/* Stats row */
.pg-stats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.pg-stat-badge {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* History */
.pg-history {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}
.pg-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}
.pg-history-pw {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.pg-history-copy {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
  transition: background var(--transition);
}
.pg-history-copy:hover { background: rgba(124,110,245,0.15); }

/* Utility */
.hidden { display: none !important; }
