/* ===== Layout ===== */
.img-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: stretch;
}

.img-main { min-width: 0; }

.img-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 2px 4px 0 rgb(15 23 42 / 0.08), 0 10px 25px -5px rgb(15 23 42 / 0.08), 0 1px 3px 0 rgb(79 70 229 / 0.05);
}

.img-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.sidebar-header {
  text-align: center;
  padding: 24px 16px !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border-color: transparent !important;
}

.sidebar-header h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sidebar-header p {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.85);
}

body[data-theme="dark"] .sidebar-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-title i { color: var(--primary); font-size: 0.9rem; }

.sidebar-tools { display: flex; flex-direction: column; gap: 8px; }

.sidebar-tool {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: all 0.2s ease;
  text-decoration: none;
  background: var(--bg-soft);
}

.sidebar-tool:hover { background: var(--primary-50); transform: translateX(3px); }

.sidebar-tool-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 16px; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

.sidebar-tool-info { flex: 1; min-width: 0; }
.sidebar-tool-name { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.sidebar-tool-desc { font-size: 0.78rem; color: var(--text-muted); }

body[data-theme="dark"] .sidebar-section { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .sidebar-tool { background: var(--bg-muted); }
body[data-theme="dark"] .sidebar-tool:hover { background: var(--primary-50); }

/* ===== Ad Placeholder ===== */
.ad-placeholder {
  width: 300px;
  height: 250px;
  flex-shrink: 0;
  margin: 0 auto;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: 14px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.ad-placeholder .ad-icon { font-size: 1.8rem; color: var(--text-muted); margin-bottom: 10px; opacity: 0.4; }
.ad-placeholder .ad-label { font-weight: 600; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.ad-placeholder .ad-size { font-size: 0.75rem; color: var(--text-muted); opacity: 0.6; }

body[data-theme="dark"] .ad-placeholder { background: var(--bg-card); border-color: var(--border); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .img-layout { grid-template-columns: 1fr 280px; gap: 20px; }
}

@media (max-width: 860px) {
  .img-layout { grid-template-columns: 1fr; }
  .img-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}

@media (max-width: 640px) {
  .img-sidebar { grid-template-columns: 1fr; }
}

/* ===== Original Styles ===== */
.img-dropzone {
  padding: 48px 20px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 22px;
}

.img-dropzone:hover,
.img-dropzone.drag {
  border-color: var(--primary);
  background: var(--primary-50);
  transform: translateY(-2px);
}

.dz-icon {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 14px;
}

.img-dropzone h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.img-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-soft);
  border-radius: 14px;
  margin-bottom: 20px;
}

.ctrl-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ctrl-item label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ctrl-item input[type="number"],
.ctrl-item select {
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  font-family: inherit;
}

.ctrl-item input[type="number"]:focus,
.ctrl-item select:focus {
  border-color: var(--primary);
}

.ctrl-item .hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

.range-row span {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  min-width: 42px;
  text-align: right;
}

.img-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--primary-50);
  border-radius: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.img-summary #summary-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.img-summary #summary-text b {
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn:hover { border-color: var(--primary); color: var(--primary); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.img-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.img-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.15s;
}

.img-item:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }

.img-preview {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.img-info {
  padding: 12px 14px;
}

.img-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.img-sizes {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.6;
}

.img-sizes .orig { color: var(--text-secondary); }
.img-sizes .new { color: var(--success); font-weight: 700; }
.img-sizes .saved { color: #ef4444; font-weight: 700; }

.img-actions {
  display: flex;
  gap: 8px;
}

.img-actions button {
  flex: 1;
  padding: 7px 10px;
  background: var(--bg-soft);
  color: var(--text-secondary);
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.img-actions button:hover { background: var(--primary); color: #fff; }
.img-actions .btn-remove:hover { background: #ef4444; }

body[data-theme="dark"] .img-dropzone {
  background: #1e293b;
  border-color: #334155;
}
body[data-theme="dark"] .img-dropzone:hover,
body[data-theme="dark"] .img-dropzone.drag {
  background: #312e81;
  border-color: #4338ca;
}
body[data-theme="dark"] .img-item {
  background: #1e293b;
  border-color: #334155;
}
body[data-theme="dark"] .img-controls {
  background: #1e293b;
}
body[data-theme="dark"] .ctrl-item input[type="number"],
body[data-theme="dark"] .ctrl-item select {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #334155;
}
body[data-theme="dark"] .img-actions button {
  background: #334155;
  color: #cbd5e1;
}
body[data-theme="dark"] .img-actions button:hover {
  background: var(--primary);
  color: #fff;
}
body[data-theme="dark"] .img-actions .btn-remove:hover {
  background: #ef4444;
}
body[data-theme="dark"] .img-preview {
  background: #0f172a;
}
body[data-theme="dark"] .btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}
body[data-theme="dark"] .btn:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}
