/* Modern Video Downloader CSS */

:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #8b5cf6;
  --secondary: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-lg: rgba(0, 0, 0, 0.15);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Auth Container */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-box {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 40px var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-box h1 {
  color: var(--primary);
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-box h2 {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 2rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: var(--surface);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-group input:invalid {
  border-color: var(--error);
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.3);
}

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

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

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
}

/* Messages */
.message, .error, .success {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

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

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

/* Auth Footer */
.auth-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.auth-footer p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Dashboard Styles */
.dashboard-container {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 40px var(--shadow-lg);
  padding: 2rem;
  margin: 2rem auto;
  max-width: 1200px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.dashboard-title {
  color: var(--primary);
  font-size: 2rem;
  font-weight: 700;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logout-btn {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background: var(--error);
  color: white;
}

/* Download Section */
.download-section {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(124, 58, 237, 0.1);
}

.download-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.url-input {
  grid-column: 1 / -1;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.url-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.platform-select, .format-select {
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
}

.download-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.3);
}

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

/* Video Preview */
.video-preview {
  display: none;
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px var(--shadow);
}

.video-preview.active {
  display: block;
}

.preview-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.preview-thumbnail {
  width: 120px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--background);
}

.preview-info h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.preview-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.preview-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Progress Bar */
.progress-container {
  display: none;
  background: var(--background);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.progress-container.active {
  display: block;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

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

.progress-text {
  text-align: center;
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Download History */
.download-history {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.history-title {
  color: var(--text-primary);
  font-size: 1.3rem;
  font-weight: 600;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--background);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.history-item:hover {
  box-shadow: 0 4px 12px var(--shadow);
}

.history-url {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.history-status {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-completed {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .download-form {
    grid-template-columns: 1fr;
  }
  
  .platform-select, .format-select {
    width: 100%;
  }
  
  .preview-header {
    flex-direction: column;
  }
  
  .preview-thumbnail {
    width: 100%;
    height: 200px;
  }
  
  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .history-item {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
}

/* Password Strength Indicator */
.password-strength {
  margin-top: 0.5rem;
}

.strength-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.strength-fill {
  height: 100%;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.strength-weak {
  width: 33%;
  background: var(--error);
}

.strength-medium {
  width: 66%;
  background: var(--warning);
}

.strength-strong {
  width: 100%;
  background: var(--success);
}

.strength-text {
  font-size: 0.8rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

.strength-weak-text {
  color: var(--error);
}

.strength-medium-text {
  color: var(--warning);
}

.strength-strong-text {
  color: var(--success);
}

/* Updated Dashboard Layout */
.download-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

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

.download-title {
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

/* URL Input with Hint */
.url-input-container {
  position: relative;
  margin-bottom: 0.5rem;
}

.url-hint {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0.7;
}

.url-input:focus + .url-hint {
  opacity: 0.5;
}

/* Video Trimmer */
.video-trimmer-container {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--background);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.trimmer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.trimmer-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.trimmer-time-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.trimmer-separator {
  opacity: 0.5;
}

.video-trimmer {
  position: relative;
  height: 40px;
  background: var(--surface);
  border-radius: 20px;
  border: 2px solid var(--border);
  cursor: pointer;
  overflow: hidden;
}

.trimmer-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  opacity: 0.1;
}

.trimmer-progress {
  position: absolute;
  top: 2px;
  left: 0;
  bottom: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 18px;
  opacity: 0.3;
}

.trimmer-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  border: 3px solid white;
  cursor: grab;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
  z-index: 10;
  touch-action: none;
  user-select: none;
}

.trimmer-handle:hover {
  transform: translateY(-50%) scale(1.2);
}

.trimmer-handle:active {
  cursor: grabbing;
  transform: translateY(-50%) scale(1.1);
}

.trimmer-start {
  left: 0;
}

.trimmer-end {
  left: 0;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .dashboard-container {
    margin: 1rem;
    padding: 1rem;
  }
  
  .download-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .user-section {
    justify-content: center;
  }
  
  .download-title {
    font-size: 1.25rem;
  }
  
  .download-form {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .download-form > div {
    grid-column: 1;
  }
  
  .url-input {
    font-size: 0.9rem;
    padding: 0.75rem;
  }
  
  .url-input-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .url-hint {
    position: static;
    transform: none;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    right: auto;
    text-align: left;
    width: 100%;
  }
  
  .platform-select,
  .format-select {
    padding: 0.5rem;
    font-size: 0.85rem;
  }
  
  .preview-header {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
  
  .preview-thumbnail {
    width: 100px;
    height: 67px;
    align-self: center;
  }
  
  .preview-info h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .trimmer-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .video-trimmer {
    height: 35px;
  }
  
  .trimmer-handle {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  
  .preview-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .preview-actions button {
    width: 100%;
  }
  
  .download-history {
    margin-top: 1rem;
  }
  
  .history-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .history-item {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .history-url {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    width: 100%;
  }
  
  .history-thumbnail {
    width: 60px;
    height: 40px;
  }
  
  .progress-container {
    padding: 1rem;
  }
  
  .logout-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
  
  .user-section i {
    font-size: 1.2rem;
  }
  
  .user-section span {
    font-size: 0.9rem;
  }
}

/* Extra Small Mobile */
@media (max-width: 480px) {
  .dashboard-container {
    margin: 0.5rem;
    padding: 0.75rem;
  }
  
  .download-section {
    padding: 1rem;
  }
  
  .download-title {
    font-size: 1.1rem;
  }
  
  .url-input {
    padding: 0.6rem;
    font-size: 0.85rem;
  }
  
  .video-trimmer-container {
    padding: 0.75rem;
  }
  
  .trimmer-time-display {
    font-size: 0.8rem;
  }
  
  .preview-info p {
    font-size: 0.85rem;
  }
}
