:root {
  --primary: #6C63FF;
  --primary-dark: #5A52E0;
  --primary-light: #e0deff;
  --text: #2D3748;
  --text-light: #718096;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --border: #E2E8F0;
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 20px;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

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

header h1 {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.drop-zone {
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 3rem;
  text-align: center;
  background: var(--card-bg);
  transition: all 0.3s;
  box-shadow: var(--shadow);
}

.drop-zone.active {
  background-color: var(--primary-light);
  border-color: var(--primary-dark);
}

.drop-zone i {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.drop-zone p {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.drop-zone span {
  display: block;
  color: var(--text-light);
  margin-bottom: 1rem;
}

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

.btn-browse:hover {
  background: var(--primary-dark);
}

.file-info {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 1rem;
}

.size-control {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  margin-top: 2rem;
  box-shadow: var(--shadow);
}

.target-input, .format-selection {
  margin-bottom: 1.5rem;
}

.target-input label, .format-selection label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.input-group select, .format-selection select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.setting {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  transition: all 0.3s;
  background: #f9f9ff;
}

.setting.enabled {
  background: white;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--primary);
}

.setting-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.75rem;
}

.dimension-inputs {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.dimension-inputs input {
  width: 100px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

#dpiInput {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
  max-width: 200px;
}

#resizeUnit {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 120px;
}

#lockBtn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-light);
  padding: 0.5rem;
}

.actions {
  display: flex;
  gap: 15px;
  margin-top: 1.5rem;
}

.btn-primary, .btn-secondary {
  flex: 1;
  padding: 0.875rem;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  transition: all 0.3s;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}

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

/* Preview UI Styles */
.preview-ui {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-container {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.thumbnail-container {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #f8f8f8;
}

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

.file-details {
  flex: 1;
}

.file-details p {
  margin: 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.btn-change {
  align-self: center;
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Loader Styles */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--primary-light);
  border-top: 5px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Hide elements with hidden attribute */
[hidden] {
  display: none !important;
}

/* Results Page Styles */
.results-container {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.compressed-preview {
  text-align: center;
  margin-bottom: 2rem;
}

.compressed-preview h3 {
  margin-bottom: 1rem;
  color: var(--primary);
}

.result-preview {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.compression-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.stat-card {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.stat-card i {
  font-size: 2rem;
  color: var(--primary);
}

.stat-card h3 {
  font-size: 1rem;
  color: var(--text-light);
}

.stat-card p {
  font-size: 1.25rem;
  font-weight: bold;
  margin-top: 0.25rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .drop-zone {
    padding: 1.5rem;
  }
  
  .preview-container {
    flex-direction: column;
    text-align: center;
  }
  
  .compression-stats {
    flex-direction: column;
    align-items: center;
  }
  
  .download-section {
    flex-direction: column;
  }
  
  .stat-card {
    width: 100%;
    max-width: none;
  }
  
  .dimension-inputs {
    flex-direction: column;
    align-items: stretch;
  }
  
  .dimension-inputs input {
    width: 100%;
  }
}

/* Prevent touch highlights on interactive elements */
button, input, select {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Improve touch target sizing */
button, .btn-browse, .btn-change {
  min-height: 44px;
  min-width: 44px;
}