/* ==========================================================
    ImageForge
    Main Stylesheet
========================================================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);

  background: var(--background);

  color: var(--text);

  min-height: 100vh;

  line-height: 1.6;

  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font-family: inherit;
}

button {
  border: none;
  outline: none;
  cursor: pointer;
}

input {
  outline: none;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* ==========================================================
    APP
========================================================== */

.app {
  width: 100%;

  max-width: var(--container-width);

  margin: auto;

  padding: 40px 20px 80px;
}

/* ==========================================================
    HEADER
========================================================== */

.header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 50px;
}

.logo {
  display: flex;

  align-items: center;

  gap: 18px;
}

.logo i {
  width: 65px;

  height: 65px;

  display: flex;

  align-items: center;

  justify-content: center;

  border-radius: 20px;

  font-size: 28px;

  color: white;

  background: linear-gradient(135deg, var(--primary), var(--secondary));

  box-shadow: var(--shadow-md);
}

.logo h1 {
  font-size: 30px;

  font-weight: 700;
}

.logo p {
  color: var(--text-secondary);

  font-size: 15px;
}

/* ==========================================================
    THEME BUTTON
========================================================== */

#themeToggle {
  width: 52px;

  height: 52px;

  border-radius: 50%;

  background: var(--surface);

  box-shadow: var(--shadow-sm);

  transition: var(--transition);
}

#themeToggle:hover {
  transform: translateY(-3px);

  box-shadow: var(--shadow-md);
}

#themeToggle i {
  font-size: 20px;

  color: var(--primary);
}

/* ==========================================================
    HERO
========================================================== */

.hero {
  text-align: center;

  margin-bottom: 45px;
}

.hero h2 {
  font-size: 52px;

  font-weight: 700;

  margin-bottom: 10px;

  background: linear-gradient(90deg, var(--primary), var(--secondary));

  -webkit-background-clip: text;

  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-secondary);

  font-size: 18px;
}

/* ==========================================================
    SECTION
========================================================== */

section {
  margin-bottom: 30px;
}

/* ==========================================================
    CARD
========================================================== */

.card {
  background: var(--surface);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-md);

  padding: 25px;
}

/* ==========================================================
    UPLOAD SECTION
========================================================== */

.upload-section {
  margin-bottom: 35px;
}

.drop-zone {
  position: relative;

  display: flex;

  flex-direction: column;

  justify-content: center;

  align-items: center;

  gap: 12px;

  min-height: 320px;

  padding: 50px;

  border: 3px dashed var(--border);

  border-radius: var(--radius-lg);

  background: linear-gradient(
    135deg,
    rgba(79, 70, 229, 0.05),
    rgba(6, 182, 212, 0.05)
  );

  transition: var(--transition);

  cursor: pointer;

  overflow: hidden;
}

.drop-zone::before {
  content: "";

  position: absolute;

  inset: 0;

  background: linear-gradient(
    135deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );

  transform: translateX(-100%);

  transition: 0.8s;
}

.drop-zone:hover::before {
  transform: translateX(100%);
}

.drop-zone:hover {
  border-color: var(--primary);

  transform: translateY(-4px);

  box-shadow: var(--shadow-lg);
}

.drop-zone.dragover {
  border-color: var(--secondary);

  background: rgba(79, 70, 229, 0.08);

  transform: scale(1.02);
}

/* ==========================================================
    UPLOAD ICON
========================================================== */

.drop-zone i {
  font-size: 72px;

  color: var(--primary);

  transition: var(--transition);

  animation: float 3s ease-in-out infinite;
}

.drop-zone:hover i {
  transform: scale(1.15);
}

.drop-zone h3 {
  font-size: 28px;

  font-weight: 600;
}

.drop-zone p {
  color: var(--text-secondary);

  font-size: 16px;
}

/* ==========================================================
    FILE INPUT
========================================================== */

.drop-zone input {
  position: absolute;

  inset: 0;

  width: 100%;

  height: 100%;

  opacity: 0;

  cursor: pointer;
}

/* ==========================================================
    URL IMPORT
========================================================== */

.url-import {
  margin-top: 20px;

  background: var(--surface);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-md);

  padding: 25px;

  transition: var(--transition);

  border: 1px solid transparent;
}

.url-import:hover {
  border-color: var(--primary-light);

  box-shadow: var(--shadow-lg);
}

.url-import-header {
  display: flex;

  align-items: center;

  gap: 10px;

  margin-bottom: 18px;

  font-size: 17px;

  font-weight: 600;
}

.url-import-header i {
  color: var(--primary);

  font-size: 18px;
}

.url-input-group {
  display: flex;

  gap: 12px;
}

.url-input-group input {
  flex: 1;

  padding: 14px 18px;

  border: 2px solid var(--border);

  border-radius: var(--radius-md);

  background: var(--background);

  color: var(--text);

  font-size: 15px;

  font-family: inherit;

  transition: var(--transition);
}

.url-input-group input::placeholder {
  color: var(--text-light);
}

.url-input-group input:hover {
  border-color: var(--primary-light);
}

.url-input-group input:focus {
  border-color: var(--primary);

  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.url-input-group button {
  display: flex;

  align-items: center;

  gap: 8px;

  padding: 14px 24px;

  background: linear-gradient(135deg, var(--primary), var(--secondary));

  color: white;

  border-radius: var(--radius-md);

  font-size: 15px;

  font-weight: 600;

  font-family: inherit;

  white-space: nowrap;

  transition: var(--transition);

  box-shadow: var(--shadow-sm);
}

.url-input-group button:hover {
  transform: translateY(-2px);

  box-shadow: var(--shadow-md);
}

.url-input-group button:active {
  transform: translateY(0);
}

.url-input-group button.loading {
  opacity: 0.7;

  pointer-events: none;
}

.url-input-group button.loading i {
  animation: spin 0.8s linear infinite;
}

.url-status {
  margin-top: 12px;

  font-size: 14px;

  font-weight: 500;

  min-height: 0;

  transition: all 0.3s ease;
}

.url-status:empty {
  margin-top: 0;
}

.url-status.success {
  color: var(--success);
}

.url-status.error {
  color: var(--danger);
}

.url-status i {
  margin-right: 6px;
}

/* ==========================================================
    CONTROL SECTION
========================================================== */

.control-section {
  margin-bottom: 35px;
}

.controls-grid {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 20px;
}

/* ==========================================================
    FORMAT CARD
========================================================== */

.format-card {
  background: var(--surface);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-md);

  padding: 25px;

  transition: var(--transition);

  border: 1px solid transparent;
}

.format-card:hover {
  border-color: var(--primary-light);

  transform: translateY(-2px);

  box-shadow: var(--shadow-lg);
}

.format-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 20px;
}

.format-header span {
  font-size: 17px;

  font-weight: 600;

  display: flex;

  align-items: center;

  gap: 10px;
}

.format-header i {
  color: var(--primary);

  font-size: 18px;
}

.format-select-wrapper {
  position: relative;
}

.format-select-wrapper select {
  width: 100%;

  padding: 14px 45px 14px 18px;

  border: 2px solid var(--border);

  border-radius: var(--radius-md);

  background: var(--background);

  color: var(--text);

  font-size: 16px;

  font-weight: 600;

  font-family: inherit;

  appearance: none;

  cursor: pointer;

  transition: var(--transition);
}

.format-select-wrapper select:hover {
  border-color: var(--primary);
}

.format-select-wrapper select:focus {
  border-color: var(--primary);

  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.format-select-wrapper i {
  position: absolute;

  right: 16px;

  top: 50%;

  transform: translateY(-50%);

  color: var(--primary);

  font-size: 14px;

  pointer-events: none;
}


.quality-card {
  background: var(--surface);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-md);

  padding: 25px;
}

.quality-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 20px;
}

.quality-header span:first-child {
  font-size: 17px;

  font-weight: 600;

  display: flex;

  align-items: center;

  gap: 10px;
}

.quality-header span:first-child i {
  color: var(--primary);

  font-size: 18px;
}

#qualityValue {
  color: var(--primary);

  font-size: 20px;

  font-weight: 700;
}

/* ==========================================================
    RANGE SLIDER
========================================================== */

#quality {
  width: 100%;

  appearance: none;

  height: 8px;

  border-radius: 999px;

  background: #dbeafe;

  cursor: pointer;
}

/* Chrome */

#quality::-webkit-slider-thumb {
  appearance: none;

  width: 22px;

  height: 22px;

  border-radius: 50%;

  background: var(--primary);

  border: 4px solid white;

  box-shadow: var(--shadow-sm);

  transition: var(--transition);
}

#quality::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Firefox */

#quality::-moz-range-thumb {
  width: 22px;

  height: 22px;

  border: none;

  border-radius: 50%;

  background: var(--primary);
}

/* ==========================================================
    FLOAT ANIMATION
========================================================== */

@keyframes float {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }

  100% {
    transform: translateY(0);
  }
}

/* ==========================================================
    STATISTICS
========================================================== */

.stats {
  display: grid;

  grid-template-columns: repeat(4, 1fr);

  gap: 20px;

  margin-bottom: 40px;
}

.stat-card {
  background: var(--surface);

  border-radius: var(--radius-lg);

  padding: 28px 20px;

  text-align: center;

  box-shadow: var(--shadow-md);

  transition: var(--transition);

  position: relative;

  overflow: hidden;

  border: 1px solid transparent;
}

.stat-card::before {
  content: "";

  position: absolute;

  top: 0;

  left: 0;

  width: 100%;

  height: 5px;

  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-card:hover {
  transform: translateY(-8px);

  box-shadow: var(--shadow-lg);

  border-color: var(--primary-light);
}

.stat-card i {
  width: 70px;

  height: 70px;

  margin: auto;

  display: flex;

  justify-content: center;

  align-items: center;

  border-radius: 50%;

  font-size: 28px;

  color: white;

  background: linear-gradient(135deg, var(--primary), var(--secondary));

  margin-bottom: 18px;
}

.stat-card h3 {
  font-size: 28px;

  font-weight: 700;

  margin-bottom: 6px;

  color: var(--text);

  word-break: break-word;
}

.stat-card span {
  color: var(--text-secondary);

  font-size: 15px;

  font-weight: 500;
}

/* ==========================================
   HOVER ICON
========================================== */

.stat-card:hover i {
  transform: rotate(10deg) scale(1.08);

  transition: var(--transition);
}

/* ==========================================
   COUNTER ANIMATION READY
========================================== */

.stat-card h3 {
  transition: 0.3s;
}

/* ==========================================
   CARD VARIANTS
========================================== */

.stat-card:nth-child(1)::before {
  background: #6366f1;
}

.stat-card:nth-child(2)::before {
  background: #10b981;
}

.stat-card:nth-child(3)::before {
  background: #06b6d4;
}

.stat-card:nth-child(4)::before {
  background: #f59e0b;
}

/* ==========================================
   ICON COLORS
========================================== */

.stat-card:nth-child(1) i {
  background: #6366f1;
}

.stat-card:nth-child(2) i {
  background: #10b981;
}

.stat-card:nth-child(3) i {
  background: #06b6d4;
}

.stat-card:nth-child(4) i {
  background: #f59e0b;
}

/* ==========================================================
    GALLERY
========================================================== */

.gallery {
  margin-bottom: 40px;
}

#imageContainer {
  display: flex;

  flex-direction: column;

  gap: 25px;
}

/* ==========================================================
    IMAGE CARD
========================================================== */

.image-card {
  background: var(--surface);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-md);

  overflow: hidden;

  transition: var(--transition);

  border: 1px solid transparent;
}

.image-card:hover {
  transform: translateY(-6px);

  box-shadow: var(--shadow-lg);

  border-color: var(--primary-light);
}

/* ==========================================================
    CARD HEADER
========================================================== */

.image-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  padding: 20px 25px;

  border-bottom: 1px solid var(--border);
}

.image-name {
  font-weight: 600;

  font-size: 16px;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.image-status {
  display: flex;

  align-items: center;

  gap: 8px;

  color: var(--success);

  font-size: 14px;

  font-weight: 600;
}

.image-status i {
  font-size: 16px;
}

/* ==========================================================
    PREVIEW
========================================================== */

.image-preview {
  display: grid;

  grid-template-columns: 1fr auto 1fr;

  gap: 20px;

  align-items: center;

  padding: 30px;
}

.preview-box {
  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 15px;
}

.preview-box img {
  width: 100%;

  max-width: 260px;

  height: 220px;

  object-fit: contain;

  background: #f8fafc;

  border-radius: var(--radius-md);

  padding: 15px;

  border: 1px solid var(--border);
}

.preview-title {
  font-size: 15px;

  font-weight: 600;

  color: var(--text-secondary);
}

.preview-arrow {
  font-size: 34px;

  color: var(--primary);
}

/* ==========================================================
    PROGRESS
========================================================== */

.progress-wrapper {
  padding: 0 30px 20px;
}

.progress-bar {
  width: 100%;

  height: var(--progress-height);

  background: #e2e8f0;

  border-radius: 999px;

  overflow: hidden;
}

.progress {
  width: 0%;

  height: 100%;

  background: linear-gradient(90deg, var(--primary), var(--secondary));

  border-radius: 999px;

  transition: width 0.4s ease;
}

/* ==========================================================
    IMAGE INFO
========================================================== */

.image-info {
  display: grid;

  grid-template-columns: repeat(3, 1fr);

  gap: 15px;

  padding: 0 30px 25px;
}

.info-box {
  background: var(--background);

  border-radius: var(--radius-md);

  padding: 18px;

  text-align: center;
}

.info-box h4 {
  font-size: 14px;

  color: var(--text-secondary);

  margin-bottom: 8px;

  font-weight: 500;
}

.info-box span {
  display: block;

  font-size: 18px;

  font-weight: 700;

  color: var(--text);
}

/* ==========================================================
    CARD FOOTER
========================================================== */

.image-footer {
  display: flex;

  justify-content: flex-end;

  align-items: center;

  gap: 15px;

  padding: 20px 25px;

  border-top: 1px solid var(--border);
}

/* ==========================================================
    DOWNLOAD BUTTON
========================================================== */

.download-btn {
  display: flex;

  align-items: center;

  gap: 10px;

  background: var(--primary);

  color: white;

  padding: 12px 22px;

  border-radius: var(--radius-full);

  font-size: 15px;

  font-weight: 600;

  transition: var(--transition);
}

.download-btn:hover {
  background: var(--primary-hover);

  transform: translateY(-2px);
}

.download-btn i {
  font-size: 15px;
}

/* ==========================================================
    DELETE BUTTON
========================================================== */

.delete-btn {
  width: 46px;

  height: 46px;

  display: flex;

  justify-content: center;

  align-items: center;

  border-radius: 50%;

  background: #fee2e2;

  color: var(--danger);

  transition: var(--transition);
}

.delete-btn:hover {
  background: var(--danger);

  color: white;

  transform: rotate(90deg);
}

/* ==========================================================
    DOWNLOAD SECTION
========================================================== */

.download-section {
  display: flex;

  justify-content: center;

  align-items: center;

  gap: 20px;

  flex-wrap: wrap;

  margin-bottom: 50px;
}

.download-section button {
  min-width: 220px;

  height: var(--button-height);

  border-radius: var(--radius-full);

  font-size: 16px;

  font-weight: 600;

  display: flex;

  justify-content: center;

  align-items: center;

  gap: 10px;

  transition: var(--transition);
}

#downloadAll {
  background: linear-gradient(135deg, var(--primary), var(--secondary));

  color: #fff;

  box-shadow: var(--shadow-md);
}

#downloadAll:hover {
  transform: translateY(-3px);

  box-shadow: var(--shadow-lg);
}

#clearAll {
  background: #fff;

  color: var(--danger);

  border: 2px solid var(--danger);
}

#clearAll:hover {
  background: var(--danger);

  color: #fff;
}

/* ==========================================================
    EMPTY STATE
========================================================== */

.empty-state {
  display: flex;

  flex-direction: column;

  justify-content: center;

  align-items: center;

  gap: 20px;

  padding: 80px 30px;

  background: var(--surface);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-sm);
}

.empty-state i {
  font-size: 70px;

  color: var(--text-light);
}

.empty-state h3 {
  font-size: 24px;
}

.empty-state p {
  color: var(--text-secondary);

  text-align: center;

  max-width: 450px;
}

/* ==========================================================
    LOADING
========================================================== */

.loading {
  display: flex;

  justify-content: center;

  align-items: center;

  gap: 15px;

  padding: 40px;
}

.spinner {
  width: 42px;

  height: 42px;

  border: 4px solid var(--border);

  border-top: 4px solid var(--primary);

  border-radius: 50%;

  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================
    GLASS
========================================================== */

.glass {
  background: var(--glass-bg);

  backdrop-filter: var(--backdrop-blur);

  border: 1px solid var(--glass-border);
}

/* ==========================================================
    UTILITIES
========================================================== */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 10px;
}

.mt-2 {
  margin-top: 20px;
}

.mt-3 {
  margin-top: 30px;
}

.mb-1 {
  margin-bottom: 10px;
}

.mb-2 {
  margin-bottom: 20px;
}

.mb-3 {
  margin-bottom: 30px;
}

/* ==========================================================
    SCROLLBAR
========================================================== */

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--background);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);

  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

/* ==========================================================
    SELECTION
========================================================== */

::selection {
  background: var(--primary);

  color: #fff;
}

/* ==========================================================
    FOOTER
========================================================== */

footer {
  margin-top: 80px;

  padding: 30px 0;

  text-align: center;

  color: var(--text-secondary);

  font-size: 15px;

  border-top: 1px solid var(--border);
}

/* ==========================================================
    ANIMATION
========================================================== */

.fade-in {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;

    transform: translateY(20px);
  }

  to {
    opacity: 1;

    transform: translateY(0);
  }
}

.scale-in {
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from {
    opacity: 0;

    transform: scale(0.9);
  }

  to {
    opacity: 1;

    transform: scale(1);
  }
}

/* ==========================================================
    DISABLED BUTTON
========================================================== */

button:disabled {
  opacity: 0.6;

  cursor: not-allowed;

  transform: none !important;

  box-shadow: none !important;
}

/* ==========================================================
    IMAGE HOVER
========================================================== */

.preview-box img {
  transition: var(--transition);
}

.preview-box img:hover {
  transform: scale(1.03);
}

/* ==========================================================
    END OF FILE
========================================================== */
