/* Hide scrollbars but allow scrolling */
* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

*::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}

:root {
  --bg-color: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --accent-color: #007aff;
  --accent-hover: #0056b3;
  --accent-light: rgba(0, 122, 255, 0.1);
  --success-color: #10b981;
  --success-hover: #059669;
  --border-color: #f1f5f9;
  /* --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05); */
  --card-shadow: 0;
  --sidebar-width: 360px;
  --border-radius: 2px;
}

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

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-logo-img {
  width: 36px;
  height: 36px;
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Main Layout */
.main-layout {
  display: flex;
  gap: 1.5rem;
  flex-grow: 1;
  height: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.main-content {
  flex-grow: 1;
  overflow-y: auto;
}

/* Card */
.card {
  background: white;
  border-radius: var(--border-radius);
  padding: 1.25rem;
  /* box-shadow: var(--card-shadow); */
  /* border: 1px dotted var(--border-color); */
  border: 1px dashed #e7e7e7;
}

.section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.section-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Upload Area */
.upload-area {
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.drop-zone {
  flex-grow: 1;
  border: 1.5px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  background: #fcfdfe;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone:hover {
  border-color: var(--accent-color);
  background: #f0f7ff;
  transform: translateY(-1px);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-icon-small {
  width: 28px;
  height: 28px;
  color: var(--accent-color);
  opacity: 0.8;
}

.drop-zone-content p {
  font-size: 0.8125rem;
  font-weight: 500;
}

.drop-zone-content span {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

/* File Info */
.file-info {
  flex-grow: 1;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-details {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

#file-preview-small {
  width: 28px;
  height: 28px;
  border-radius: var(--border-radius);
  object-fit: cover;
}

.file-meta {
  display: flex;
  flex-direction: column;
}

#file-name {
  font-size: 0.75rem;
  font-weight: 600;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#file-res {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

/* Controls */
.control-group {
  margin-bottom: 1rem;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.label-row label {
  font-size: 0.8125rem;
  font-weight: 600;
}

.label-row span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-color);
  background: var(--accent-light);
  padding: 1px 6px;
  border-radius: calc(var(--border-radius) - 1px);
}

.label-desc {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Style Selector */
.style-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.style-option {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

.style-option img {
  width: 28px;
  height: 28px;
  margin-bottom: 0.25rem;
}

.style-option span {
  display: block;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.style-option:hover {
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

.style-option.active {
  border-color: var(--accent-color);
  background: var(--accent-light);
  box-shadow: 0 0 0 1px var(--accent-color);
}

.style-option.active span {
  color: var(--accent-color);
}

/* Preview Grid */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.preview-item {
  text-align: center;
}

.canvas-wrapper {
  background: #fcfdfe;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  margin-bottom: 0.375rem;
  transition: transform 0.2s;
}

.canvas-wrapper:hover {
  transform: scale(1.02);
}

.canvas-wrapper canvas {
  max-width: 100%;
  max-height: 100%;
  height: auto !important;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}

.size-label {
  font-size: 0.6875rem;
  font-weight: 600;
}

.scale-label {
  font-size: 0.625rem;
  color: var(--text-secondary);
}

/* Download Section */
.download-section {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.download-info {
  flex-grow: 1;
}

.download-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
}

.download-section p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  transition: all 0.2s;
}

.btn-primary-alt {
  background: var(--accent-color);
  color: white;
  padding: 0.4375rem 1rem;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
  padding: 0.625rem 1.25rem;
}

.btn-success {
  background-color: var(--accent-color);
  color: white;
  padding: 0.75rem 1.5rem;
  min-width: 220px;
}

.btn-success:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.125rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
}

.btn-icon:hover {
  color: #ef4444;
}

/* Alert */
.info-alert {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--accent-light);
  border-radius: var(--border-radius);
  display: flex;
  gap: 0.625rem;
  color: var(--accent-color);
  font-size: 0.75rem;
  line-height: 1.4;
  border: 1px solid var(--accent-light);
}

.icon-small {
  width: 16px;
  height: 16px;
}

.app-footer {
  text-align: center;
  padding: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  flex-shrink: 0;
}

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

/* Inputs */
input[type="range"] {
  width: 100%;
  accent-color: var(--accent-color);
  height: 4px;
  background: #f1f5f9;
  border-radius: 2px;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  background: white;
  border: 2px solid var(--accent-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.canvas-wrapper {
  position: relative;
}
.download-single {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 6px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(5px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.canvas-wrapper:hover .download-single {
  opacity: 1;
  transform: translateY(0);
}
.download-single svg {
  width: 14px;
  height: 14px;
}
.download-single:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
  body {
    overflow-y: auto;
    height: auto;
  }

  .app-container {
    height: auto;
    padding: 1rem;
    overflow: visible;
  }

  .main-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
    gap: 1.5rem;
  }

  .sidebar {
    width: 100%;
    max-height: none;
    border-right: none;
    overflow: visible;
  }

  .main-content {
    width: 100%;
    height: auto;
    padding: 0;
    overflow: visible;
  }

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

@media (max-width: 640px) {
  .app-header {
    padding: 1rem;
    text-align: center;
  }

  .logo-area {
    flex-direction: column;
    gap: 0.75rem;
  }

  .logo-text {
    text-align: center;
  }

  .preview-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .upload-area {
    min-height: 120px;
  }

  .btn-success {
    width: 100%;
    min-width: 0;
  }

  .download-section {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }
}
