:root {
  --bg: #0a0a0f;
  --bg-elevated: #12121a;
  --bg-card: #16161f;
  --border: #2a2a3a;
  --text: #e8e8ed;
  --text-muted: #8888a0;
  --accent: #00d4aa;
  --accent-dim: #00d4aa30;
  --accent-glow: #00d4aa50;
  --danger: #ff6b6b;
  --warning: #ffd93d;
}

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

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  direction: rtl;
}

.gradient-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-dim), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, #4a1d7a20, transparent),
    radial-gradient(ellipse 50% 30% at 100% 80%, #1d4a7a20, transparent);
  pointer-events: none;
  z-index: 0;
}

.grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 24px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 48px;
  animation: fadeIn 0.6s ease-out;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.logo svg {
  color: var(--text);
}

h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: 400;
}

/* Input Section */
.input-section {
  margin-bottom: 32px;
  animation: fadeIn 0.6s ease-out 0.1s both;
}

.input-wrapper {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px;
  transition: all 0.3s ease;
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim), 0 8px 32px rgba(0, 0, 0, 0.3);
}

input[type="url"] {
  flex: 1;
  background: transparent;
  border: none;
  padding: 16px 20px;
  font-family: 'Cairo', monospace;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  direction: ltr;
  text-align: left;
}

input[type="url"]::placeholder {
  color: var(--text-muted);
}

/* Buttons */
.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 16px 28px;
  border-radius: 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 14px 24px;
  border-radius: 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-ghost:hover {
  color: var(--accent);
}

/* Status Section */
.status-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  animation: slideUp 0.4s ease-out;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.phase-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pulse {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

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

#phaseText {
  font-weight: 600;
  color: var(--text);
}

.counter {
  font-family: 'Cairo', sans-serif;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
}

#urlCount {
  font-weight: 700;
  font-size: 1.2rem;
}

/* Progress Bar */
.progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-bar.large {
  height: 10px;
  border-radius: 5px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #00ff88);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: inherit;
}

/* Log */
.log-container {
  background: var(--bg-elevated);
  border-radius: 12px;
  overflow: hidden;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.log-content {
  height: 180px;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: 'Cairo', monospace;
  font-size: 0.85rem;
  line-height: 2;
  direction: ltr;
  text-align: left;
}

.log-content::-webkit-scrollbar {
  width: 6px;
}

.log-content::-webkit-scrollbar-track {
  background: transparent;
}

.log-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.log-entry {
  color: var(--text-muted);
  animation: fadeIn 0.2s ease;
}

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

.log-entry.error {
  color: var(--danger);
}

/* Results Section */
.results-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  animation: slideUp 0.4s ease-out;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.results-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.url-list {
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 8px;
}

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

.url-list::-webkit-scrollbar-track {
  background: transparent;
}

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

.url-item {
  padding: 12px 16px;
  border-radius: 8px;
  font-family: 'Cairo', monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.2s;
  word-break: break-all;
  direction: ltr;
  text-align: left;
}

.url-item:hover {
  background: var(--bg-card);
  color: var(--text);
}

/* Download Section */
.download-section {
  animation: slideUp 0.4s ease-out;
}

.download-progress {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.download-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.download-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.download-counter {
  font-family: 'Cairo', sans-serif;
  color: var(--accent);
  font-weight: 700;
  direction: ltr;
}

.current-file {
  margin-top: 16px;
  font-family: 'Cairo', monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  direction: ltr;
  text-align: left;
}

/* Complete Section */
.complete-section {
  animation: slideUp 0.4s ease-out;
}

.complete-card {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 48px;
  text-align: center;
  box-shadow: 0 0 60px var(--accent-dim);
}

.complete-icon {
  margin-bottom: 24px;
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.complete-card h2 {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.complete-card p {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 1.05rem;
}

.complete-card code {
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: 'Cairo', monospace;
  font-size: 0.95rem;
  color: var(--accent);
  direction: ltr;
}

.complete-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Utilities */
.hidden {
  display: none !important;
}

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

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

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 32px 16px;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .input-wrapper {
    flex-direction: column;
  }
  
  .btn-primary {
    width: 100%;
    justify-content: center;
  }
  
  .results-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  
  .complete-actions {
    flex-direction: column;
  }
  
  .complete-actions .btn-primary,
  .complete-actions .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}
