/* Base Styles */
:root {
  --background: 210 40% 98%;
  --foreground: 222 47% 11%;
  --card: 0 0% 100%;
  --card-foreground: 222 47% 11%;
  --popover: 0 0% 100%;
  --popover-foreground: 222 47% 11%;
  --primary: 222 47% 11%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222 47% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 208 100% 50%;
  --radius: 0.75rem;
}

.dark {
  --background: 222 47% 11%;
  --foreground: 210 40% 98%;
  --card: 222 47% 11%;
  --card-foreground: 210 40% 98%;
  --popover: 222 47% 11%;
  --popover-foreground: 210 40% 98%;
  --primary: 210 40% 98%;
  --primary-foreground: 222 47% 11%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 208 100% 50%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-color: hsl(var(--border));
  transition: color 0.3s, background-color 0.3s;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: linear-gradient(to bottom right, hsl(var(--background)), hsla(var(--secondary), 0.3));
  color: hsl(var(--foreground));
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a, button, input, select, textarea {
  transition: all 0.2s;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: hsla(var(--muted-foreground), 0.3);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: hsla(var(--muted-foreground), 0.5);
}

/* Layout */
.imagesqueeze-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid hsla(var(--border), 0.5);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: hsla(var(--primary), 0.1);
  border-radius: 0.5rem;
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.logo-text p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.header-nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: hsl(var(--foreground));
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  position: relative;
}

.nav-link:hover {
  color: hsl(var(--primary));
}

.nav-link:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: hsl(var(--primary));
  transition: width 0.2s;
}

.nav-link:hover:after {
  width: 100%;
}

.app-content {
  flex: 1;
  padding: 2rem;
}

.content-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .content-container {
    grid-template-columns: 2fr 1fr;
  }
}

.left-column, .right-column {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Section Headers */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: hsl(var(--muted-foreground));
  font-size: 1rem;
}

.section-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-info h3 {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.section-info p {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Drop Zone */
.drop-zone {
  min-height: 220px;
  border: 2px dashed hsla(var(--primary), 0.3);
  border-radius: 0.75rem;
  background-color: hsla(var(--primary), 0.05);
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  text-align: center;
}

.drop-zone.active {
  border-color: hsla(var(--primary), 0.6);
  background-color: hsla(var(--primary), 0.1);
  transform: scale(1.02);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.upload-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: hsla(var(--primary), 0.1);
  border-radius: 9999px;
  margin-bottom: 1rem;
  transition: transform 0.3s;
}

.drop-zone:hover .upload-icon {
  transform: scale(1.1);
}

.drop-zone h3 {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: hsl(var(--primary));
}

.drop-zone p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1rem;
  max-width: 300px;
}

.btn-browse {
  padding: 0.5rem 1rem;
  background-color: hsla(var(--primary), 0.1);
  color: hsl(var(--primary));
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background-color 0.2s;
}

.btn-browse:hover {
  background-color: hsla(var(--primary), 0.2);
}

.supported-formats {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.hidden {
  display: none !important;
}

.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: hsla(var(--background), 0.5);
  border-radius: 0.75rem;
}

/* Compressed Images Section */
.compressed-images-section {
  margin-top: 2rem;
}

.processing-message {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  gap: 0.5rem;
  color: hsl(var(--primary));
  font-size: 0.875rem;
}

.image-results-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
}

@media (min-width: 640px) {
  .image-results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .image-results-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Image Cards */
.image-card {
  background-color: white;
  border-radius: 0.75rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03), 0 4px 20px rgba(0, 0, 0, 0.04);
  padding: 1rem;
  transition: all 0.3s;
  overflow: hidden;
  animation: scaleIn 0.3s ease-out;
}

.dark .image-card {
  background-color: hsl(var(--card));
}

.image-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(0, 0, 0, 0.06);
}

.image-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: hsl(var(--muted));
  border-radius: 0.5rem;
}

.image-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: hsla(var(--background), 0.7);
  z-index: 5;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.3s;
}

.compare-button {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: hsla(var(--background), 0.9);
  border: 1px solid hsl(var(--border));
  border-radius: 9999px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 10;
}

.image-preview:hover .compare-button {
  opacity: 0.9;
  transform: translateY(0);
}

.compare-button:hover {
  background-color: white;
}

.dark .compare-button:hover {
  background-color: hsl(var(--card));
}

.image-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.25rem 0.5rem;
  background-color: hsla(var(--background), 0.9);
  border: 1px solid hsl(var(--border));
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--primary));
  z-index: 10;
}

.original-size-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.5rem;
  background-color: hsla(var(--background), 0.9);
  border: 1px solid hsl(var(--border));
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--primary));
  z-index: 10;
}

.image-info {
  margin-top: 0.75rem;
}

.image-details {
  margin-bottom: 0.5rem;
}

.filename {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90%;
}

.reduction-info {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.image-actions {
  display: flex;
  gap: 0.25rem;
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.download-button, .remove-button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  color: hsl(var(--primary));
  opacity: 0.7;
  transition: all 0.2s;
}

.download-button:hover {
  opacity: 1;
  background-color: hsla(var(--secondary), 0.7);
}

.remove-button {
  color: hsl(var(--destructive));
}

.remove-button:hover {
  opacity: 1;
  background-color: hsla(var(--destructive), 0.1);
}

.size-info {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* Buttons */
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  background-color: transparent;
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--primary));
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover:not(:disabled) {
  background-color: hsl(var(--secondary));
}

.btn-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger {
  color: hsl(var(--destructive));
}

.btn-danger:hover:not(:disabled) {
  background-color: hsla(var(--destructive), 0.1);
}

/* Settings Panels */
.compression-settings, .features-list {
  padding: 1.5rem;
  background-color: hsla(var(--background), 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid hsla(var(--border), 0.3);
  border-radius: 0.75rem;
  animation: fadeIn 0.3s ease-out;
}

.dark .compression-settings,
.dark .features-list {
  background-color: hsla(var(--card), 0.8);
  border-color: hsla(var(--border), 0.3);
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.settings-header h3 {
  font-size: 1.125rem;
  font-weight: 500;
}

.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tab-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  width: 100%;
  border-radius: 0.5rem;
  background-color: hsl(var(--secondary));
  padding: 0.25rem;
}

.tab-button {
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  background: none;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  text-align: center;
}

.tab-button.active {
  background-color: white;
  color: hsl(var(--primary));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dark .tab-button.active {
  background-color: hsl(var(--card));
}

.tab-panel {
  display: none;
  animation: slideUp 0.4s ease-out;
}

.tab-panel.active {
  display: block;
}

/* Slider Control */
.slider-control {
  margin-bottom: 1.25rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.slider-header label {
  font-size: 0.875rem;
  font-weight: 500;
}

.quality-label, .size-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  padding: 0.125rem 0.5rem;
  background-color: hsla(var(--muted), 0.5);
  border-radius: 9999px;
}

.slider {
  width: 100%;
  height: 8px;
  background-color: hsl(var(--secondary));
  border-radius: 9999px;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: white;
  border: 2px solid hsl(var(--primary));
  cursor: pointer;
  transition: all 0.2s;
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: white;
  border: 2px solid hsl(var(--primary));
  cursor: pointer;
  transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.slider::-moz-range-thumb:hover {
  transform: scale(1.1);
}

/* Switch Control */
.switch-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: hsl(var(--input));
  transition: .4s;
  border-radius: 24px;
  border: 2px solid transparent;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 1px;
  bottom: 1px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .switch-slider {
  background-color: hsl(var(--primary));
}

input:checked + .switch-slider:before {
  transform: translateX(20px);
}

input:disabled + .switch-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.disabled-label {
  color: hsl(var(--muted-foreground));
}

/* Compression Types */
.compression-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.compression-type-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  transition: all 0.2s;
  cursor: pointer;
  background: none;
  text-align: center;
}

.compression-type-button.active {
  background-color: hsla(var(--primary), 0.1);
  border-color: hsla(var(--primary), 0.3);
}

.compression-type-button:hover:not(.active) {
  background-color: hsl(var(--secondary));
}

.compression-type-button i {
  margin-bottom: 0.5rem;
  color: hsla(var(--primary), 0.7);
}

.compression-type-button span {
  font-size: 0.875rem;
  font-weight: 500;
}

.compression-type-button p {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

/* Format Options */
.format-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.format-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  transition: all 0.2s;
  cursor: pointer;
  background: none;
}

.format-button.active {
  background-color: hsla(var(--primary), 0.1);
  border-color: hsla(var(--primary), 0.3);
}

.format-button:hover:not(.active) {
  background-color: hsl(var(--secondary));
}

.format-button i {
  margin-bottom: 0.25rem;
  color: hsla(var(--primary), 0.7);
}

.format-button span {
  font-size: 0.75rem;
  font-weight: 500;
}

.metadata-options {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--border));
}

.metadata-options h4 {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

/* Features List */
.features-list {
  margin-top: 1.5rem;
}

.features-list h3 {
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.features-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.features-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.feature-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background-color: hsla(var(--primary), 0.1);
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--primary));
  margin-top: 0.125rem;
}

.feature-text {
  flex: 1;
}

.feature-title {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
}

.feature-desc {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  max-width: 350px;
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.3s ease-out;
  overflow: hidden;
  margin-top: 0.5rem;
}

.dark .toast {
  background-color: hsl(var(--card));
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.toast-message {
  font-size: 0.875rem;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  margin-left: 0.5rem;
  border-radius: 9999px;
  transition: all 0.2s;
}

.toast-close:hover {
  background-color: hsl(var(--secondary));
  color: hsl(var(--primary));
}

.toast-success .toast-icon {
  color: #4caf50;
}

.toast-error .toast-icon {
  color: #f44336;
}

.toast-info .toast-icon {
  color: #2196f3;
}

.toast-warning .toast-icon {
  color: #ff9800;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateX(20px);
  }
  to { 
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from { 
    opacity: 0;
    transform: scale(0.95);
  }
  to { 
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .app-header {
    padding: 0.75rem 1rem;
  }
  
  .logo-text h1 {
    font-size: 1.25rem;
  }
  
  .header-nav {
    gap: 1rem;
  }

  .app-content {
    padding: 1rem;
  }
  
  .section-header h2 {
    font-size: 1.5rem;
  }
  
  .section-header-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .action-buttons {
    width: 100%;
    justify-content: space-between;
  }
  
  .drop-zone {
    min-height: 180px;
    padding: 1rem;
  }
  
  .upload-icon {
    width: 48px;
    height: 48px;
  }
  
  .drop-zone h3 {
    font-size: 1.125rem;
  }
  
  .tab-button {
    font-size: 0.75rem;
    padding: 0.25rem;
  }
  
  .format-options {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .compression-settings, .features-list {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .action-buttons {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .btn-outline {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .format-options {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tab-list {
    gap: 0.25rem;
    padding: 0.125rem;
  }
}
