/* ================================================
   Global Styles & CSS Variables
   ================================================ */

:root {
    /* Keep Crewly purple branding */
    --primary-color: #667eea;
    --primary-hover: #5568d3;
    --success-color: #10B981;
    --success-hover: #059669;
    --danger-color: #EF4444;
    --secondary-color: #8B92A8;
    --secondary-hover: #A8AFBF;
    
    /* Dark mode backgrounds */
    --bg-main: #0f1117;
    --bg-card: #1a1d29;
    --bg-drop-zone: #252936;
    --bg-drop-zone-hover: #2e3342;
    
    /* Dark mode text */
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Dark mode borders */
    --border-color: #2e3342;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
    
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================================
   Layout Container
   ================================================ */

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

/* ================================================
   Header
   ================================================ */

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ================================================
   Upload Section
   ================================================ */

.upload-section {
    margin-bottom: 2rem;
}

.drop-zone {
    background: var(--bg-card);
    border: 3px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: var(--bg-drop-zone-hover);
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.drop-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.drop-subtext {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.btn-browse {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-browse:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.supported-formats {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ================================================
   Error Messages
   ================================================ */

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: #fca5a5;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-message::before {
    content: "⚠️";
    font-size: 1.25rem;
}

.hidden {
    display: none !important;
}

/* ================================================
   Quality Controls
   ================================================ */

.quality-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.quality-controls label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

#qualityValue {
    color: var(--primary-color);
    font-weight: 700;
}

#qualitySlider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-drop-zone);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

#qualitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

#qualitySlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 8px rgba(79, 70, 229, 0.1);
}

#qualitySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

#qualitySlider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 8px rgba(79, 70, 229, 0.1);
}

.quality-note {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ================================================
   Preview Section
   ================================================ */

.preview-section {
    margin-bottom: 2rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.preview-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.preview-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.image-preview {
    width: 100%;
    height: 250px;
    background: var(--bg-drop-zone);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 1rem;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-info {
    font-size: 0.875rem;
}

.image-info p {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.image-info p:last-child {
    border-bottom: none;
}

.image-info strong {
    color: var(--text-secondary);
    font-weight: 600;
}

.reduction-highlight {
    color: var(--success-color);
    font-weight: 700;
    font-size: 1rem;
}

/* ================================================
   Processing Status
   ================================================ */

.processing-status {
    text-align: center;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-drop-zone);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================================
   Action Buttons
   ================================================ */

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

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

.btn-success:hover:not(:disabled) {
    background: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ================================================
   Footer / Privacy Section
   ================================================ */

footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.privacy-section {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.privacy-section h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.privacy-section > p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.privacy-details {
    margin-top: 1rem;
}

.privacy-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    padding: 0.5rem 0;
    user-select: none;
}

.privacy-details summary:hover {
    color: var(--primary-hover);
}

.privacy-content {
    padding: 1rem 0;
}

.privacy-content h4 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.privacy-content ul {
    list-style: none;
    padding: 0;
}

.privacy-content li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.privacy-content li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: 700;
}

.footer-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

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

/* ================================================
   Responsive Design
   ================================================ */

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .drop-zone {
        padding: 2rem 1rem;
    }
    
    .preview-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }
    
    .btn-browse {
        padding: 0.625rem 1.5rem;
        font-size: 0.875rem;
    }
}
/* ============================================ */
/* CREWLY CODES STYLES */
/* Add this to your main.css file */
/* ============================================ */

/* Top Corner Badge */
.crewly-corner-badge {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.crewly-corner-badge a {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s;
}

.crewly-corner-badge a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.crewly-corner-icon {
  font-size: 16px;
}

/* Footer Attribution */
.crewly-footer {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px 20px;
  margin-top: 60px;
}

.crewly-footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.crewly-footer-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crewly-badge-icon {
  font-size: 32px;
}

.crewly-badge-text strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.crewly-badge-text span {
  display: block;
  font-size: 13px;
  opacity: 0.9;
}

.crewly-footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.crewly-footer-links a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.crewly-footer-links a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.crewly-divider {
  opacity: 0.5;
}

/* Crewly Codes Modal */
.crewly-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

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

.crewly-modal-content {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin: 5% auto;
  padding: 0;
  max-width: 600px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.crewly-modal-close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 32px;
  font-weight: bold;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.crewly-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.crewly-modal-header {
  padding: 40px 40px 30px;
  text-align: center;
}

.crewly-modal-header h2 {
  margin: 0 0 10px 0;
  font-size: 28px;
  font-weight: 700;
}

.crewly-modal-subtitle {
  margin: 0;
  font-size: 16px;
  opacity: 0.9;
}

.crewly-modal-body {
  padding: 0 40px 30px;
}

.crewly-modal-body > p:first-child {
  text-align: center;
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 30px;
  opacity: 0.95;
}

.crewly-process {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.crewly-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}

.crewly-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.crewly-step-content {
  flex: 1;
}

.crewly-step-content strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.crewly-step-content p {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

.crewly-arrow {
  text-align: center;
  font-size: 20px;
  margin: 4px 0;
  opacity: 0.7;
}

.crewly-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.crewly-stat {
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 16px 8px;
  border-radius: 8px;
}

.crewly-stat strong {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

.crewly-stat span {
  display: block;
  font-size: 12px;
  opacity: 0.8;
}

.crewly-privacy {
  text-align: center;
  font-size: 14px;
  opacity: 0.9;
  margin: 0;
}

.crewly-modal-footer {
  background: rgba(0, 0, 0, 0.2);
  padding: 30px 40px;
  text-align: center;
  border-radius: 0 0 16px 16px;
}

.crewly-modal-footer > p:first-child {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
}

.crewly-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.crewly-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}

.crewly-btn-primary {
  background: white;
  color: #667eea;
}

.crewly-btn-primary:hover {
  background: #e8e8e8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.crewly-btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.crewly-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.crewly-powered {
  margin: 0;
  font-size: 13px;
  opacity: 0.8;
}

.crewly-powered strong {
  font-weight: 600;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .crewly-corner-badge {
    top: 10px;
    right: 10px;
  }
  
  .crewly-corner-text {
    display: none;
  }
  
  .crewly-corner-badge a {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .crewly-footer-content {
    flex-direction: column;
    text-align: center;
  }
  
  .crewly-footer-badge {
    flex-direction: column;
    text-align: center;
  }
  
  .crewly-footer-links {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .crewly-modal-content {
    margin: 10px;
    max-width: calc(100% - 20px);
  }
  
  .crewly-modal-header,
  .crewly-modal-body,
  .crewly-modal-footer {
    padding-left: 24px;
    padding-right: 24px;
  }
  
  .crewly-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .crewly-modal-actions {
    flex-direction: column;
  }
  
  .crewly-btn {
    width: 100%;
  }
}