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

:root {
  /* Dimensions and Fonts */
  --mono: "JetBrains Mono", monospace;
  --sans: "Syne", sans-serif;

  /* Primary brand color */
  --accent: #1db453;
}

/* 
 * Light / Dark Theme Variables 
 */
html[data-theme="dark"] {
  --bg: #0b0c0e;
  --surface: #111316;
  --border: #1e2127;
  --text: #e8e9ed;
  --text-heading: #ffffff;
  --muted: #5a5f6b;
  --success: #1db453;
  --error: #ff4d6a;
  --grid-color: rgba(29, 180, 83, 0.025);
  --glow-color: rgba(29, 180, 83, 0.05);
  --card-gradient: linear-gradient(
    90deg,
    transparent,
    var(--accent),
    transparent
  );
  --hover-bg: rgba(255, 255, 255, 0.02);
}

html[data-theme="light"] {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #334155;
  --text-heading: #0f172a;
  --muted: #64748b;
  --success: #1db453;
  --error: #ef4444;
  --grid-color: rgba(29, 180, 83, 0.05);
  --glow-color: rgba(29, 180, 83, 0.08);
  --card-gradient: linear-gradient(
    90deg,
    transparent,
    var(--accent),
    transparent
  );
  --hover-bg: rgba(0, 0, 0, 0.02);
}

/* Base Body Styles */
html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Background grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* Glow orb */
body::after {
  content: "";
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
}

.wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px 80px;
  max-width: 780px;
  margin: 0 auto;
}

.wrapper.wide {
  max-width: 1100px;
}

/* Top Navigation (Theme Switcher) */
.top-nav {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  text-decoration: none;
}

.theme-toggle:hover {
  color: var(--text-heading);
  border-color: var(--muted);
}

.quota-mini-badge {
  background: rgba(29, 180, 83, 0.08);
  border: 1px solid rgba(29, 180, 83, 0.2);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  text-decoration: none;
}

.quota-mini-badge:hover {
  background: rgba(29, 180, 83, 0.12);
  border-color: var(--accent);
}

.logout-btn {
  color: #ef4444 !important; /* reddish */
  border-color: rgba(239, 68, 68, 0.2) !important;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.08) !important;
  color: #ef4444 !important;
  border-color: #ef4444 !important;
}

/* Header */
header {
  width: 100%;
  margin-bottom: 52px;
  text-align: center;
}

/* Logo tag removed */

h1 {
  font-size: clamp(22px, 8vw, 42px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(
    135deg,
    var(--text-heading) 30%,
    var(--accent) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
}

.sub {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Base Card */
.card,
.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.card {
  padding: 36px 36px 32px;
}

.auth-card {
  max-width: 420px;
  padding: 40px;
  margin-top: 20px;
}

.card::before,
.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--card-gradient);
  opacity: 0.5;
}

.auth-card h2 {
  color: var(--text-heading);
  font-size: 25px;
  margin-bottom: 8px;
}

.auth-card .sub-text {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 28px;
}

/* Form Fields */
.input-label,
.auth-card label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}

.url-row {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  background: var(--surface-brighter);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  transition: all 0.2s;
  outline: none;
  box-sizing: border-box;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 180, 83, 0.1);
}

.form-group {
  margin-bottom: 24px;
}

.input-label {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.auth-card input {
  margin-bottom: 18px;
}
.url-row input::placeholder,
.field input::placeholder,
.auth-card input::placeholder {
  color: var(--muted);
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Submit Button */
.btn {
  width: 100%;
  padding: 15px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  letter-spacing: 0.02em;
  /* Removed transform/lift on hover, changed to bg/shadow only */
  transition:
    box-shadow 0.15s,
    background 0.15s;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: #179b46; /* slightly darker accent */
}

.btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.btn .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

.btn.loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn.loading .spinner {
  display: block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Platform Badge (Jargon removed) */
.platform-badge {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
}
.platform-badge.visible {
  display: flex;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* Result panel */
#result {
  width: 100%;
  margin-top: 28px;
  display: none;
  flex-direction: column;
  gap: 0;
  animation: fadeUp 0.4s ease both;
}

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

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 14px 20px;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.result-title {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.copy-btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(29, 180, 83, 0.08);
  border: 1px solid rgba(29, 180, 83, 0.2);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.copy-btn:hover {
  background: rgba(29, 180, 83, 0.16);
}

.tabs {
  display: flex;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  gap: 0;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.tab {
  flex: 1;
  padding: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition:
    color 0.2s,
    border-color 0.2s;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.result-body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

#lines-view {
  display: block;
}
#plain-view {
  display: none;
}

.line-row {
  display: flex;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  transition:
    background 0.15s,
    border-color 0.3s ease;
}

.line-row:last-child {
  border-bottom: none;
}
.line-row:hover {
  background: var(--hover-bg);
}

.ts {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  min-width: 68px;
  padding-top: 2px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.line-text {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

#plain-view pre {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  line-height: 1.8;
  white-space: pre-wrap;
  padding: 20px;
}

/* Error */
.error-box {
  width: 100%;
  margin-top: 24px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--error);
  display: none;
  animation: fadeUp 0.3s ease both;
}

/* Footer (Updated for Copyright & Links) */
footer {
  margin-top: 180px; /* Increased from 48px */
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 0px;
}

/* Dashboard Layout */
.dashboard-container {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13px;
  transition:
    background 0.2s,
    color 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}

.sidebar-nav-item:hover {
  background: var(--surface);
  border-color: var(--border);
}

.sidebar-nav-item.active {
  background: rgba(29, 180, 83, 0.1);
  color: var(--accent);
  border-color: rgba(29, 180, 83, 0.2);
}

.sidebar-nav-item.logout {
  margin-top: auto;
  color: #ef4444;
}

.sidebar-nav-item.logout:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

/* History Page Refinements */
.history-title {
  font-size: clamp(32px, 6vw, 48px) !important;
  margin-top: 10px;
}

.history-back {
  margin-bottom: 24px;
}

.dashboard-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  animation: fadeUp 0.4s ease both;
  min-height: 500px;
}

.dashboard-section {
  display: none;
}

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

.section-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.section-header h2 {
  margin: 0;
  font-family: var(--syne);
  font-size: 23px;
}

@media (max-width: 800px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }
  .dashboard-sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
  }
  .sidebar-nav-item {
    white-space: nowrap;
  }
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
}

.builder-credit {
  margin-top: 8px;
}

.builder-credit a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.builder-credit a:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .card {
    padding: 24px 20px;
  }
  .time-row {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 22px;
  }
  .top-nav {
    justify-content: center;
  }
}

/* Password Toggle */
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.label-row label {
  margin-bottom: 0 !important;
}
.text-toggle {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 0;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.text-toggle:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Flash Messages */
.flash-msg,
.flash-message {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--error);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flash-msg.success,
.flash-message.success {
  background: rgba(29, 180, 83, 0.08);
  border-color: rgba(29, 180, 83, 0.2);
  color: var(--accent);
}
.flash-msg.info,
.flash-message.info {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.auth-card .alt-link {
  text-align: center;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.auth-card .alt-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.auth-card .alt-link a:hover {
  text-decoration: underline;
}

/* Auth Helpers */
.pwd-hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: -12px;
  margin-bottom: 18px;
}
.back-home {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}

/* Auth & Verification Layouts */
.auth-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
  position: relative;
}

.auth-header-nav {
  position: absolute;
  top: 40px;
  left: 40px;
  right: 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

@media (max-width: 600px) {
  .auth-header-nav {
    position: static;
    margin-bottom: 40px;
    flex-direction: column-reverse;
    align-items: center;
    gap: 16px;
    width: 100%;
  }

  .auth-header-nav .top-nav {
    justify-content: center;
    margin: 0;
  }

  .auth-header-nav .back-home {
    margin: 0;
  }
}

.otp-input {
  letter-spacing: 0.4em;
  font-weight: 700;
  text-align: center;
  font-size: 24px !important;
}

.verify-nav {
  display: flex;
  justify-content: center;
  margin-top: 24px;
  gap: 16px;
  font-family: var(--mono);
  font-size: 13px;
}

.resend-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
}
.resend-btn:disabled {
  color: var(--muted);
  text-decoration: none;
  cursor: not-allowed;
}

/* Loading States & Spinners */
.spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn.loading .spinner {
  display: inline-block;
}

.btn.loading .btn-text {
  opacity: 0.7;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

/* Custom Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

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

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.modal-icon.warning {
  background: rgba(255, 170, 0, 0.1);
  color: #ffaa00;
  border: 1px solid rgba(255, 170, 0, 0.2);
}

.modal-icon.danger {
  background: rgba(255, 80, 80, 0.1);
  color: #ff5050;
  border: 1px solid rgba(255, 80, 80, 0.2);
}

.modal-icon.info {
  background: rgba(43, 144, 255, 0.1);
  color: #2b90ff;
  border: 1px solid rgba(43, 144, 255, 0.2);
}

.modal-title {
  font-family: var(--syne);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.modal-message {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.modal-btn {
  padding: 10px 20px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: none;
}

.modal-btn-cancel {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.modal-btn-cancel:hover {
  background: var(--surface-brighter);
  border-color: var(--text);
}

.modal-btn-confirm {
  background: var(--text);
  color: var(--bg);
}

.modal-btn-confirm:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.modal-btn-danger {
  background: #ff5050;
  color: white;
}

.modal-btn-danger:hover {
  background: #e63e3e;
  transform: scale(1.02);
}
