:root {
  --bg-primary: #0b0f19;
  --bg-card: rgba(22, 28, 45, 0.65);
  --bg-card-hover: rgba(22, 28, 45, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.2);
  
  --primary: #6366f1; /* Neon Indigo */
  --primary-glow: rgba(99, 102, 241, 0.5);
  --secondary: #06b6d4; /* Neon Cyan */
  --success: #10b981; /* Emerald Green */
  --danger: #ef4444; /* Rose Red */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --font-display: 'Outfit', sans-serif;
  --font-sans: 'Plus Jakarta Sans', sans-serif;
  
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-neon: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background Glow Effects */
.background-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.35;
}

.orb-1 {
  background: var(--primary);
  width: 50vw;
  height: 50vw;
  top: -10vw;
  right: -10vw;
}

.orb-2 {
  background: var(--secondary);
  width: 40vw;
  height: 40vw;
  bottom: -5vw;
  left: -10vw;
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 2.2rem;
  animation: float 6s ease-in-out infinite;
}

.logo h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo h1 span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Status Badge */
.connection-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.connection-pill.connected {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.connection-pill.connected .status-dot {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.connection-pill.disconnected {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

.connection-pill.disconnected .status-dot {
  background-color: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Main Container */
.app-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 2rem 3rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Glass Card styling */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow-glow);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow: var(--shadow-glow), var(--shadow-neon);
}

.text-center { text-align: center; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.w-full { width: 100%; }

.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* Role Selection Grid */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2.5rem;
}

.role-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.role-btn:hover {
  background: rgba(99, 102, 241, 0.05);
  border-color: var(--primary);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.15);
}

.role-icon {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease;
}

.role-btn:hover .role-icon {
  transform: scale(1.15) rotate(-5deg);
}

.role-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.role-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Grid Layouts */
.grid-2col {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
}

.grid-2col-receiver {
  display: grid;
  grid-template-columns: 0.8fr 1.4fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  .grid-2col, .grid-2col-receiver {
    grid-template-columns: 1fr;
  }
}

/* Forms & Buttons */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: #fff;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  width: 100%;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: monospace;
  font-size: 0.8rem;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  width: 100%;
}

.password-input-wrapper input {
  padding-right: 2.5rem;
}

.password-input-wrapper .btn-icon {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.helper-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-family: var(--font-display);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #0ea5e9;
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: #fff;
  transition: all 0.2s ease;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.08);
}

.text-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}

.text-btn:hover {
  color: #fff;
}

.danger-text {
  color: var(--danger) !important;
}

.danger-text:hover {
  text-shadow: 0 0 5px rgba(239, 68, 68, 0.3);
}

/* Tabs */
.tab-buttons {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Drag & Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.drop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.drop-icon {
  font-size: 2.5rem;
}

.drop-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 1.25rem 1rem;
  border-radius: 12px;
  text-align: center;
}

.stat-val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--secondary);
}

.stat-lbl {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: block;
}

/* File Tree / Explorer styling */
.file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.file-tree-container {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  min-height: 180px;
  max-height: 350px;
  overflow-y: auto;
  padding: 1rem;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem 0;
  text-align: center;
}

.tree-node {
  margin-left: 1rem;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.tree-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.tree-row.selected {
  background: rgba(99, 102, 241, 0.1);
  border-left: 2px solid var(--primary);
}

.tree-name {
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tree-actions {
  display: flex;
  gap: 0.25rem;
}

.tree-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
}

.tree-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Transfer Rows */
.transfer-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.transfer-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
}

.transfer-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.transfer-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.transfer-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  width: 0%;
  transition: width 0.1s ease;
}

/* Helpers */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.button-group-small {
  display: flex;
  gap: 0.5rem;
}

.copy-input-group {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.copy-input-group textarea {
  flex-grow: 1;
}

.download-dir-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.download-dir-indicator em {
  color: var(--success);
  font-style: normal;
  font-weight: 600;
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
}

.lock-icon {
  font-size: 3rem;
  animation: pulse 2s infinite;
  display: inline-block;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 2rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  max-width: 1400px;
  width: 100%;
  margin: 2rem auto 0;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* Debug Console styles */
.debug-console-wrapper {
  position: fixed;
  bottom: 0;
  right: 2rem;
  width: 450px;
  max-width: calc(100vw - 4rem);
  background: rgba(11, 15, 25, 0.95);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
  z-index: 1000;
  font-family: monospace;
  font-size: 0.75rem;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.debug-console-wrapper.collapsed {
  max-height: 40px;
}

.debug-console-wrapper.expanded {
  max-height: 350px;
}

.debug-console-header {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--secondary);
}

.debug-console-content {
  padding: 1rem;
  height: 310px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.4);
}

.log-line {
  line-height: 1.4;
  word-break: break-all;
  text-align: left;
}

.log-time {
  color: var(--text-muted);
}

.log-info {
  color: var(--text-main);
}

.log-success {
  color: var(--success);
}

.log-warn {
  color: var(--secondary);
}

.log-error {
  color: var(--danger);
  font-weight: bold;
}

/* Gatekeeper Overlay styles */
.gatekeeper-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  backdrop-filter: blur(25px);
  z-index: 10000; /* Sit on top of absolutely everything */
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.gatekeeper-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gatekeeper-card {
  width: 400px;
  max-width: calc(100vw - 3rem);
  padding: 3.5rem 2rem;
  border-color: var(--primary-glow);
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.25);
  background: rgba(15, 20, 35, 0.8) !important;
}
