:root {
  --bg-primary: #07090E;
  --bg-secondary: #0D111A;
  --bg-tertiary: #141A29;
  --accent-cyan: #00F2FE;
  --accent-blue: #4FACFE;
  --accent-glow: rgba(0, 242, 254, 0.25);
  --text-primary: #FFFFFF;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 242, 254, 0.5);
  
  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --error: #EF4444;
  --error-glow: rgba(239, 68, 68, 0.2);
  --warning: #F59E0B;
  --warning-glow: rgba(245, 158, 11, 0.2);
  --info: #3B82F6;
  --info-glow: rgba(59, 130, 246, 0.2);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  --gradient-accent: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-cyan) 100%);
  --gradient-success: linear-gradient(135deg, #059669 0%, #10B981 100%);
  --gradient-card: linear-gradient(145deg, rgba(20, 26, 41, 0.7) 0%, rgba(13, 17, 26, 0.85) 100%);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(79, 172, 254, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(0, 242, 254, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  overflow-x: hidden;
}

/* Animations */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Overlays & Login */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 9, 14, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  padding: 20px;
}

.overlay.active {
  opacity: 1;
  pointer-events: all;
}

.glass-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  animation: slideUp var(--transition-normal);
}

.brand {
  position: relative;
  text-align: center;
  margin-bottom: 32px;
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  background: var(--gradient-accent);
  filter: blur(25px);
  opacity: 0.3;
  border-radius: 50%;
  pointer-events: none;
  animation: pulse 4s infinite ease-in-out;
}

.brand-icon {
  width: 64px;
  height: 64px;
  background: var(--gradient-accent);
  border-radius: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(0, 242, 254, 0.2);
  color: var(--bg-primary);
}

.brand-icon svg {
  width: 32px;
  height: 32px;
}

.brand h1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.5px;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

/* Inputs & Form Groups */
.input-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.input-group label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
  padding-left: 2px;
}

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

input[type="password"],
input[type="text"],
textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 14px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="password"]:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 12px var(--accent-glow);
  background: rgba(255, 255, 255, 0.05);
}

textarea {
  resize: none;
  font-size: 14px;
}

/* Remember Me & Switch Styling */
.remember-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background: var(--gradient-accent);
  border-color: transparent;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Buttons */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
  width: auto;
  gap: 8px;
  position: relative;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--gradient-accent);
  color: #000;
  box-shadow: 0 4px 16px rgba(0, 242, 254, 0.15);
}

.btn-primary:not(:disabled):hover {
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.3);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s infinite linear;
}

.btn-loader.hidden {
  display: none;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* App Container */
.container {
  width: 100%;
  max-width: 480px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
  animation: fadeIn var(--transition-normal);
}

.container.hidden {
  display: none;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 8px 4px;
}

.header-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-text {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-badge {
  font-size: 11px;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 30px;
  color: var(--text-secondary);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.dot.online {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.dot.offline {
  background-color: var(--error);
  box-shadow: 0 0 8px var(--error);
}

/* Cards */
.card {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Tabs */
.tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn var(--transition-normal);
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
  background: rgba(255, 255, 255, 0.01);
  position: relative;
  text-align: center;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.02);
  box-shadow: inset 0 0 15px rgba(0, 242, 254, 0.04);
}

.hidden-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.prompt-icon {
  color: var(--text-secondary);
  margin-bottom: 12px;
  transition: transform var(--transition-normal) cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dropzone:hover .prompt-icon {
  transform: translateY(-4px) scale(1.05);
  color: var(--accent-cyan);
}

.prompt-icon svg {
  width: 36px;
  height: 36px;
}

.prompt-text h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.prompt-text p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Uploaded file UI in Dropzone */
.dropzone-filehidden {
  display: flex;
  align-items: center;
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
  gap: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  z-index: 2;
}

.dropzone-filehidden.hidden {
  display: none;
}

.file-icon {
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
}

.file-icon svg {
  width: 28px;
  height: 28px;
}

.file-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  text-align: left;
  overflow: hidden;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.remove-btn:hover {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.mt-4 {
  margin-top: 16px;
}

/* Torrents List Section */
.torrents-section {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 4px;
}

.section-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  color: var(--text-secondary);
}

.torrents-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual Torrent Items */
.torrent-item {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.torrent-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.torrent-main-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.torrent-info {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.torrent-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.torrent-meta {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.meta-dot {
  width: 3px;
  height: 3px;
  background-color: var(--text-muted);
  border-radius: 50%;
}

/* Torrent Actions */
.torrent-actions {
  display: flex;
  gap: 4px;
}

.action-btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.action-btn-success:hover {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

/* Progress bar */
.torrent-progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 3px;
  width: 0;
  transition: width 0.5s ease-out;
}

.progress-bar-fill.seeding {
  background: var(--gradient-success);
}

.progress-bar-fill.paused {
  background: var(--text-muted);
}

.torrent-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
}

.progress-percentage {
  color: var(--text-primary);
}

.torrent-speeds {
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
}

.speed-down, .speed-up {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.speed-down svg, .speed-up svg {
  width: 10px;
  height: 10px;
}

.speed-down {
  color: var(--accent-cyan);
}

.speed-up {
  color: var(--success);
}

/* Torrent States Badge colors */
.torrent-state {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
}

.state-downloading {
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.2);
}

.state-seeding {
  background: var(--success-glow);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.state-paused {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.state-checking, .state-queued {
  background: var(--warning-glow);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.state-error {
  background: var(--error-glow);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Empty State / Loader */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

.empty-icon {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-icon svg {
  width: 48px;
  height: 48px;
}

.empty-state p {
  font-size: 14px;
}

/* Toast System */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 20, 32, 0.95);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--error);
}

.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-info {
  border-left: 3px solid var(--info);
}

.toast-icon svg {
  width: 18px;
  height: 18px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

.toast-content {
  flex: 1;
  line-height: 1.4;
}

/* Responsive Hacks */
@media (max-width: 480px) {
  body {
    background-image: 
      radial-gradient(at 0% 0%, rgba(79, 172, 254, 0.08) 0px, transparent 60%),
      radial-gradient(at 100% 100%, rgba(0, 242, 254, 0.08) 0px, transparent 60%);
  }
  
  .container {
    padding: 12px;
  }
  
  .card {
    padding: 16px;
    border-radius: var(--radius-md);
  }
}
