:root {
  /* Light theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #dee2e6;
  --accent-primary: #3498db;
  --accent-secondary: #2980b9;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #17a2b8;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  
  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;
  
  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #404040;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #888888;
  --border-color: #404040;
  --accent-primary: #4a9eff;
  --accent-secondary: #357abd;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header cu design îmbunătățit */
header {
  background: var(--bg-primary);
  padding: 24px 32px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), var(--success), var(--warning));
}

header h1 {
  color: var(--text-primary);
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-info {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.remaining-requests {
  background: var(--bg-tertiary);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
}

.user-info a {
  color: var(--accent-primary);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  font-weight: 500;
}

.user-info a:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  transform: translateY(-1px);
}

/* Tabs Design */
.tabs {
  display: flex;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 6px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.tab-button {
  flex: 1;
  padding: 12px 24px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
  position: relative;
}

.tab-button.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.tab-button:not(.active):hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Forms cu design modern */
.url-form {
  background: var(--bg-primary);
  padding: 32px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  margin-bottom: 32px;
  border: 1px solid var(--border-color);
  position: relative;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
  transform: translateY(-1px);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
  font-family: 'Fira Code', monospace;
}

.form-group small {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
  display: block;
}

/* Buttons cu efecte avansate */
button {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button:disabled::before {
  display: none;
}

/* Messages cu animații */
.message {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  border-left: 4px solid;
  animation: slideIn 0.3s ease-out;
  position: relative;
}

@keyframes slideIn {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.message.success {
  background: rgba(39, 174, 96, 0.1);
  color: var(--success);
  border-color: var(--success);
}

.message.error {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger);
  border-color: var(--danger);
}

.message.info {
  background: rgba(52, 152, 219, 0.1);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Quick Stats Cards */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-primary);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-primary);
  transform: scaleY(0);
  transition: transform var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
  transform: scaleY(1);
}

.stat-icon {
  font-size: 2rem;
  background: var(--bg-tertiary);
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Templates Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.template-card {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  position: relative;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.template-card h4 {
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.template-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
  word-break: break-all;
}

.template-card small {
  color: var(--text-muted);
  font-size: 0.8rem;
  display: block;
  margin-bottom: 12px;
}

.template-card button {
  padding: 8px 16px;
  font-size: 0.9rem;
  width: 100%;
}

/* Jobs Grid */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.job-card {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  position: relative;
}

.job-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.job-card.status-completed::before { background: var(--success); }
.job-card.status-pending::before { background: var(--warning); }
.job-card.status-processing::before { background: var(--info); }
.job-card.status-failed::before { background: var(--danger); }

.job-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.job-id {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.status {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status.pending { background: rgba(243, 156, 18, 0.2); color: var(--warning); }
.status.processing { background: rgba(23, 162, 184, 0.2); color: var(--info); }
.status.completed { background: rgba(39, 174, 96, 0.2); color: var(--success); }
.status.failed { background: rgba(231, 76, 60, 0.2); color: var(--danger); }

.job-url {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 8px;
  word-break: break-all;
}

.job-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.job-actions {
  display: flex;
  gap: 8px;
}

.btn-download,
.btn-share {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-download {
  background: var(--success);
  color: white;
}

.btn-share {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-download:hover,
.btn-share:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }
  
  header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
    padding: 20px;
  }
  
  .user-info {
    justify-content: center;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .tab-button {
    margin-bottom: 4px;
  }
  
  .url-form {
    padding: 20px;
  }
  
  .quick-stats {
    grid-template-columns: 1fr;
  }
  
  .templates-grid {
    grid-template-columns: 1fr;
  }
  
  .jobs-grid {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    flex-direction: column;
    text-align: center;
  }
}

/* Dark Mode Toggle */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
  z-index: 1000;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

/* Loading Animations */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  z-index: 1000;
  animation: slideInRight 0.3s ease-out;
  max-width: 400px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Turnstile responsive */
.cf-turnstile {
  margin: 16px 0;
}

@media (max-width: 480px) {
  .cf-turnstile {
    transform: scale(0.8);
    transform-origin: 0 0;
  }
}