/* ========== VARIABLES ========== */
:root {
  --primary-color: #4A69FF;
  --primary-dark: #3A59EF;
  --primary-light: #5A79FF;
  --success-color: #1DD1A1;
  --error-color: #ef4444;

  --bg-color: #212529;
  --card-bg: rgba(255, 255, 255, 0.05);
  --text-primary: #F8F9FA;
  --text-secondary: #ADB5BD;
  --border-color: rgba(173, 181, 189, 0.2);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  --transition: all 0.3s ease;
}

/* ========== RESET & BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ========== HEADER ========== */
.header {
  background: rgba(33, 37, 41, 0.8);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  font-size: 1.125rem;
  font-weight: 800;
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: default;
  user-select: none;
}

.logo-text {
  cursor: default;
  user-select: none;
}

.btn-config {
  padding: 0.5rem 1rem;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
}

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

/* ========== HERO SECTION ========== */
.hero {
  text-align: center;
  padding: 3rem 1.5rem;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
}

.hero-emoji {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

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

/* ========== MAIN CONTENT ========== */
.main-content {
  padding: 2rem 0;
}

/* ========== UPLOAD SECTION ========== */
.upload-section {
  margin-bottom: 1.5rem;
}

.upload-area {
  background: var(--card-bg);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: rgba(74, 105, 255, 0.05);
}

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

.upload-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.upload-hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.btn-select {
  margin-top: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-select:hover {
  background: rgba(74, 105, 255, 0.9);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.image-preview {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.image-preview img {
  max-width: 100%;
  max-height: 350px;
  border-radius: var(--radius-md);
  display: block;
  margin: 0 auto;
}

.btn-remove {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  background: var(--error-color);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove:hover {
  background: #DC2626;
}

/* ========== OPTIONS SECTION ========== */
.options-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.options-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.intensity-slider {
  margin-top: 0;
}

.slider-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.slider-min,
.slider-max {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 60px;
}

.slider-min {
  text-align: right;
}

input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: none;
}

.slider-value {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 0.25rem;
}

/* ========== ACTION SECTION ========== */
.action-section {
  text-align: center;
  margin-bottom: 2rem;
}

.btn-transform {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-transform:hover:not(:disabled) {
  background: rgba(74, 105, 255, 0.9);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

/* ========== PROCESSING OVERLAY ========== */
.processing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.processing-modal {
  background: #212529;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  max-width: 450px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

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

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

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

.processing-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ========== RESULT SECTION ========== */
.result-section {
  margin-bottom: 2rem;
}

.result-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.comparison-container {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.comparison-wrapper {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.comparison-image {
  width: 100%;
}

.comparison-image img {
  width: 100%;
  display: block;
}

.comparison-image.original {
  position: absolute;
  top: 0;
  left: 0;
  clip-path: inset(0 50% 0 0);
}

.image-label {
  position: absolute;
  top: 0.75rem;
  background: rgba(33, 37, 41, 0.9);
  backdrop-filter: blur(4px);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.75rem;
}

.comparison-image.original .image-label {
  left: 0.75rem;
}

.comparison-image.result .image-label {
  right: 0.75rem;
}

.comparison-slider {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  background: white;
  cursor: ew-resize;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.slider-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  box-shadow: var(--shadow-md);
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  max-width: 700px;
  margin: 0 auto;
}

.btn-action {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

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

.btn-download:hover {
  background: rgba(29, 209, 161, 0.9);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-save {
  background: rgba(173, 181, 189, 0.2);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-save:hover {
  background: rgba(173, 181, 189, 0.3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ========== GALLERY SECTION ========== */
.gallery-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.gallery-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-delete {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  background: rgba(239, 68, 68, 0.95);
  backdrop-filter: blur(4px);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: var(--transition);
  opacity: 0;
}

.gallery-item:hover .gallery-item-delete {
  opacity: 1;
}

.gallery-item-delete:hover {
  background: #DC2626;
  transform: scale(1.1);
}

/* ========== FOOTER ========== */
.footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-credits {
  margin-top: 0.25rem;
  font-weight: 600;
}

/* ========== LIMIT MODAL ========== */
.limit-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.limit-modal-content {
  background: #212529;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  max-width: 450px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: slideInScale 0.3s ease;
}

.limit-modal-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.limit-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.limit-modal-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.btn-modal-close {
  margin-top: 1.5rem;
  padding: 0.875rem 2rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-modal-close:hover {
  background: rgba(74, 105, 255, 0.9);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

@keyframes slideInScale {
  from {
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ========== DELETE MODAL ========== */
.delete-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.delete-modal-content {
  background: #212529;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  max-width: 450px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: slideInScale 0.3s ease;
}

.delete-modal-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.delete-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.delete-modal-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.delete-modal-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.btn-modal-cancel {
  padding: 0.875rem 1.5rem;
  background: rgba(173, 181, 189, 0.2);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-modal-cancel:hover {
  background: rgba(173, 181, 189, 0.3);
  transform: translateY(-1px);
}

.btn-modal-confirm {
  padding: 0.875rem 1.5rem;
  background: var(--error-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-modal-confirm:hover {
  background: #DC2626;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .header .container {
    padding: 0.875rem 1rem;
  }

  .logo {
    font-size: 1.125rem;
  }

  .logo-icon {
    font-size: 1.375rem;
  }

  .btn-config {
    font-size: 0.8125rem;
    padding: 0.5rem 0.875rem;
  }

  .hero {
    padding: 1.5rem 1rem;
  }

  .hero-emoji {
    font-size: 2.5rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.9375rem;
  }

  .main-content {
    padding: 1.5rem 0;
  }

  .upload-area {
    padding: 2rem 1rem;
  }

  .upload-icon {
    font-size: 2.5rem;
  }

  .upload-text {
    font-size: 0.9375rem;
  }

  .image-preview {
    padding: 1rem;
  }

  .image-preview img {
    max-height: 300px;
  }

  .options-section {
    padding: 1.25rem;
  }

  .slider-min,
  .slider-max {
    font-size: 0.6875rem;
    min-width: 50px;
  }

  .btn-transform {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
  }

  .processing-modal {
    padding: 1.5rem;
  }

  .processing-title {
    font-size: 1.125rem;
  }

  .result-title {
    font-size: 1.25rem;
  }

  .comparison-container {
    padding: 1rem;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .btn-action {
    width: 100%;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.375rem;
  }

  .upload-area {
    padding: 1.5rem 0.75rem;
  }

  .comparison-wrapper {
    border-radius: var(--radius-sm);
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.5rem;
  }
}
