/* Side Dropdown Menu */
.side-dropdown {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.dropdown-toggle {
  background: var(--primary-color);
  border: none;
  border-radius: 0 12px 12px 0;
  padding: 0.7rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: 0 2px 8px var(--shadow);
  transition: var(--transition);
  outline: none;
}
.dropdown-bar {
  width: 24px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transition: 0.3s;
}
.dropdown-toggle.active .dropdown-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.dropdown-toggle.active .dropdown-bar:nth-child(2) {
  opacity: 0;
}
.dropdown-toggle.active .dropdown-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}
.dropdown-menu {
  background: var(--surface);
  border-radius: 0 12px 12px 0;
  box-shadow: 0 4px 16px var(--shadow);
  margin-top: 0.5rem;
  min-width: 180px;
  padding: 0.7rem 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  border-left: 4px solid var(--primary-color);
}
.dropdown-menu.open {
  display: flex;
  animation: fadeInLeft 0.3s;
}
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}
.dropdown-link {
  display: flex;
  align-items: center;
  color: var(--primary-color);
  background: var(--secondary-color);
  text-decoration: none;
  padding: 0.7rem 1rem;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 1rem;
  transition: var(--transition);
  box-shadow: 0 1px 4px var(--shadow);
}
.dropdown-link:hover {
  background: var(--primary-hover);
  color: #fff;
  transform: scale(1.04);
  box-shadow: 0 4px 12px var(--shadow-hover);
}

/* External Link Button */
.external-link-btn {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  background: var(--primary-color);
  color: #fff;
  text-decoration: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 1rem;
  border: none;
  box-shadow: 0 2px 8px var(--shadow);
  transition: var(--transition);
  z-index: 1000;
}
.external-link-btn:hover {
  background: var(--primary-hover);
  color: #fff;
  transform: translateY(-50%) scale(1.04);
  box-shadow: 0 6px 18px var(--shadow-hover);
}
/* CSS Variables for Light and Dark Themes */
:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-color: #f3f4f6;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --background: #ffffff;
  --surface: #f9fafb;
  --border: #e5e7eb;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-hover: rgba(0, 0, 0, 0.15);
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --background: #111827;
  --surface: #1f2937;
  --border: #374151;
  --secondary-color: #374151;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
}

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  position: relative;
}

.logo {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* Authentication Section */
.auth-section {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.github-login-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #24292e;
  color: white;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  transition: var(--transition);
  border: 2px solid #24292e;
}

.github-login-btn:hover {
  background: #1a1e22;
  border-color: #1a1e22;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(36, 41, 46, 0.3);
}

.github-icon {
  width: 20px;
  height: 20px;
}

.auth-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border);
}

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

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.user-details {
  display: flex;
  flex-direction: column;
  text-align: left;
}

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

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

.logout-btn {
  background: var(--error);
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
}

.theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--secondary-color);
  transform: scale(1.1);
}

/* Main Content */
.main-content {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

/* Upload Section */
.upload-section {
  margin-bottom: 2rem;
}

.upload-area {
  border: 3px dashed var(--border);
  border-radius: var(--border-radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary-color);
  background: var(--background);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--shadow);
}

.upload-content h2 {
  font-size: 1.5rem;
  margin: 1rem 0 0.5rem;
  color: var(--text-primary);
}

.upload-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.supported-formats {
  background: var(--secondary-color);
  padding: 1rem;
  border-radius: var(--border-radius-sm);
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.file-size-limit {
  font-size: 0.8rem;
  color: var(--warning);
  font-weight: 500;
}

/* File Info Section */
.file-info-section {
  margin-bottom: 2rem;
}

.file-info {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
}

.file-info h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.file-details p {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* Conversion Section */
.conversion-section {
  margin-bottom: 2rem;
}

.conversion-options {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
}

.conversion-options h3 {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.option-group {
  margin-bottom: 1.5rem;
}

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

.option-group select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--border-radius-sm);
  background: var(--background);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

.option-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.convert-btn {
  width: 100%;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: var(--border-radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.convert-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--shadow-hover);
}

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

/* Progress Section */
.progress-section {
  margin-bottom: 2rem;
}

.progress-container {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  text-align: center;
}

.progress-container h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--secondary-color);
  border-radius: 6px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--success));
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 6px;
}

.progress-text {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.progress-percentage {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* Results Section */
.results-section {
  margin-bottom: 2rem;
}

.results-container {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  text-align: center;
}

.results-container h3 {
  margin-bottom: 1.5rem;
  color: var(--success);
}

.size-comparison {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.size-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--background);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border);
}

.size-item .label {
  font-weight: 500;
  color: var(--text-primary);
}

.compression-ratio {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  border: none;
}

.download-section {
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

.download-btn,
.new-conversion-btn,
.retry-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.download-btn {
  background: var(--success);
  color: white;
}

.download-btn:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--shadow-hover);
}

.new-conversion-btn,
.retry-btn {
  background: var(--secondary-color);
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.new-conversion-btn:hover,
.retry-btn:hover {
  background: var(--border);
  transform: translateY(-1px);
}

/* Error Section */
.error-section {
  margin-bottom: 2rem;
}

.error-container {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--error);
  text-align: center;
}

.error-container h3 {
  color: var(--error);
  margin-bottom: 1rem;
}

.error-message {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  color: white;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* Responsive Design */
@media (min-width: 640px) {
  .download-section {
    flex-direction: row;
  }
  
  .size-comparison {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 480px) {
  .header {
    padding: 1rem;
  }
  
  .logo {
    font-size: 2rem;
  }
  
  .upload-area {
    padding: 2rem 1rem;
  }
  
  .theme-toggle {
    top: 0.5rem;
    right: 0.5rem;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .auth-profile {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  .user-info {
    gap: 0.5rem;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
  }
  
  .github-login-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Focus styles for accessibility */
button:focus,
select:focus,
input:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: #000000;
    --text-secondary: #000000;
  }
  
  [data-theme="dark"] {
    --border: #ffffff;
    --text-secondary: #ffffff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}