/* RapidLeech Modern UI - CSS Variables for Theming */
:root {
  /* Light Theme (default) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: #ffffff;
  --bg-progress: #e2e8f0;
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-accent: #3b82f6;
  
  --border-color: #e2e8f0;
  --border-light: rgba(255, 255, 255, 0.1);
  
  --accent-primary: #3b82f6;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --accent-glow: rgba(59, 130, 246, 0.3);
  
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: rgba(30, 41, 59, 0.8);
  --bg-card-hover: rgba(30, 41, 59, 1);
  --bg-input: #1e293b;
  --bg-progress: #334155;
  
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-accent: #60a5fa;
  
  --border-color: #334155;
  --border-light: rgba(255, 255, 255, 0.05);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 20%, var(--accent-glow) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Links */
a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

/* Main Container */
.rl-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.rl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.rl-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rl-logo img {
  height: 40px;
  width: auto;
}

.rl-logo-text {
  font-size: 24px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  box-shadow: var(--shadow-md);
}

.theme-toggle-track {
  width: 48px;
  height: 26px;
  background: var(--bg-progress);
  border-radius: 13px;
  position: relative;
  transition: background-color 0.3s ease;
}

[data-theme="dark"] .theme-toggle-track {
  background: var(--accent-primary);
}

.theme-toggle-thumb {
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(22px);
}

.theme-icon {
  font-size: 18px;
}

/* Main Layout */
.rl-main {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

@media (max-width: 968px) {
  .rl-main {
    grid-template-columns: 1fr;
  }
}

/* Sidebar */
.rl-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Cards */
.rl-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.rl-card:hover {
  box-shadow: var(--shadow-lg);
}

.rl-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.rl-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  color: white;
  font-size: 18px;
}

.rl-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.rl-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* Plugin List */
.plugin-list {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 8px;
}

.plugin-list::-webkit-scrollbar {
  width: 6px;
}

.plugin-list::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.plugin-list::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 3px;
}

.plugin-item {
  padding: 8px 12px;
  margin: 4px 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.plugin-item:hover {
  background: var(--accent-primary);
  color: white;
}

/* Action Buttons */
.rl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.rl-btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.rl-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.rl-btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.rl-btn-secondary:hover {
  background: var(--bg-secondary);
}

.rl-btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.rl-btn-block {
  width: 100%;
}

/* Tabs Navigation */
.rl-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  padding: 6px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.rl-tab {
  flex: 1;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.rl-tab:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.rl-tab.active, .rl-tab.selected {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-md);
}

/* Legacy tab classes */
.cell-nav {
  flex: 1;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.cell-nav:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.cell-nav.selected {
  background: var(--accent-gradient) !important;
  color: white !important;
  box-shadow: var(--shadow-md);
}

/* Tab Content */
.tab-content, .rl-tab-content {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.hide-table {
  display: none;
}

/* Form Elements */
.rl-form-group {
  margin-bottom: 20px;
}

.rl-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.rl-input, input[type="text"], input[type="password"], input[type="email"], textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  font-family: inherit;
}

.rl-input:focus, input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

input[type="text"], input[type="password"] {
  max-width: 400px;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* Checkbox */
.rl-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

.rl-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Select */
select {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Submit Button */
input[type="submit"], input[type="button"], button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px var(--accent-glow);
}

input[type="submit"]:hover, input[type="button"]:hover, button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

/* Progress Bar */
.rl-progress-container, .progressouter {
  background: var(--bg-progress);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 24px;
  width: 100%;
  max-width: 400px;
  margin: 20px auto;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  border: none;
}

.rl-progress-bar, .progressdown, .progressup {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
  margin: 0;
}

.rl-progress-bar::after, .progressdown::after, .progressup::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.rl-progress-info {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* File List */
.rl-file-list {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.filelist {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.filelist th, .filelist td {
  padding: 14px 16px;
  text-align: left;
}

.flisttblhdr {
  background: var(--accent-gradient) !important;
  color: white !important;
}

.flisttblhdr td, .flisttblhdr th {
  color: white;
  font-weight: 600;
  border: none;
}

.flistmouseoff {
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.flistmouseon {
  background: var(--accent-primary) !important;
  color: white !important;
}

.flisttblftr {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.filelist a {
  color: var(--text-accent);
  text-decoration: none;
}

.filelist a:hover {
  text-decoration: underline;
}

/* File Actions Menu */
.chkmenu {
  color: var(--text-accent);
  font-weight: 500;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin: 0 4px;
  transition: all 0.2s ease;
}

.chkmenu:hover {
  background: var(--accent-primary);
  color: white;
  text-decoration: none;
}

/* Status Colors */
.g, .checkerp { color: var(--success); }
.y { color: var(--warning); }
.r, .checkerf { color: var(--error); }

/* Warning & Error Messages */
.warning {
  color: var(--warning);
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--warning);
}

.htmlerror {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--error);
  line-height: 1.6;
}

/* Server Stats */
.ss-cpu-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 16px;
}

.ss-td-style, .cpu-td {
  background: var(--bg-tertiary);
  padding: 20px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  vertical-align: top;
}

.ss-span-style, .cpu-span {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 14px;
}

/* Link Checker */
.workswith {
  background: var(--bg-tertiary);
  padding: 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px;
  max-height: 100px;
  overflow: auto;
  border: 1px solid var(--border-color);
  text-align: center;
  margin: 16px auto;
  max-width: 500px;
}

#linkchecker-results {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

/* Auto Download/Upload Buttons */
.button-auto {
  width: 100%;
  margin: 8px 0;
  padding: 12px 20px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.button-auto:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* Plugin Badge */
.cell-plugin {
  background: var(--accent-gradient);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-align: center;
  margin-bottom: 12px;
}

.plugincolhd {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  text-align: center;
}

.plugincollst {
  color: var(--text-muted);
  font-size: 12px;
}

/* Table Content */
.tab-content, #tb_content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 16px;
}

/* Horizontal Rule */
hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 20px 0;
}

/* Autodelete Notice */
.autodel {
  color: var(--warning);
  font-weight: 500;
  padding: 8px 16px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: var(--radius-sm);
  display: inline-block;
}

/* MD5 Table */
.md5table {
  font-family: 'Monaco', 'Consolas', monospace;
  color: var(--text-accent);
}

.md5table th {
  background: var(--bg-tertiary);
  border: none;
  padding: 12px 16px;
}

.md5table td {
  background: var(--bg-secondary);
  padding: 12px 16px;
}

/* RAR/UNRAR Tables */
.rar-table {
  text-align: left;
}

.rar-main-td, .rar-rb-td, .rar-options-left-td, .rar-options-right-td,
.unrar-main-td, .unrar-main2-td, .unrar-lb-td, .unrar-rb-td, .unrar-options {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
}

/* Notes */
.notes {
  width: 100%;
  min-height: 300px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: inherit;
}

/* Credits */
.rl-link {
  text-decoration: none;
}

.rev-dev {
  color: var(--accent-primary);
}

.small-credits {
  color: var(--text-muted);
  font-size: 12px;
}

.rapidleechhost {
  text-align: center;
  font-weight: 600;
}

/* Container */
.container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.adlinks {
  width: 100%;
  max-width: 600px;
  height: 400px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  margin: 16px auto;
  display: block;
}

/* Transfer UIs */
.transloadui, .uploadui {
  font-family: inherit;
  text-align: center;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin: 20px auto;
  max-width: 500px;
}

/* Upload Styles */
.upstyles-dllink, .upstyles-dellink, .upstyles-statlink,
.upstyles-admlink, .upstyles-userid, .upstyles-ftpuplink, .upstyles-accesspass {
  width: 100%;
  max-width: 500px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 8px 0;
  word-break: break-all;
}

/* Title */
.title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.style1 {
  font-size: 14px;
  font-weight: 600;
}

.style2 {
  font-weight: 600;
}

/* FTP Progress */
.ftpprogress {
  background: var(--accent-gradient);
  margin: 2px;
  height: 8px;
  border-radius: 4px;
}

/* Loading Animation */
.linkchecker-load {
  opacity: 0.3;
}

/* Font Colors */
.font-black {
  color: var(--text-primary);
}

.font-blue {
  color: var(--text-accent);
}

/* Legacy Compatibility */
tr {
  font-family: inherit;
  font-size: inherit;
  line-height: 1.6;
  color: var(--text-primary);
}

table {
  border-collapse: collapse;
}

center {
  text-align: center;
}

img {
  border: 0;
  max-width: 100%;
  height: auto;
}

/* Caption */
.caption {
  font-size: 12px;
  color: var(--text-muted);
}

th {
  border: none;
}

/* Responsive Tables */
@media (max-width: 768px) {
  .rl-tabs {
    flex-wrap: wrap;
  }
  
  .rl-tab, .cell-nav {
    flex: 1 1 45%;
    font-size: 12px;
    padding: 10px;
  }
  
  .tab-content, .rl-tab-content {
    padding: 16px;
  }
  
  input[type="text"], input[type="password"], textarea {
    max-width: 100%;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }
  
  .theme-toggle, .rl-sidebar {
    display: none;
  }
}
