/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;
  --bg-hover: #2a2a2a;
  --text-primary: #e8e8e8;
  --text-secondary: #999;
  --text-muted: #666;
  --border-color: #333;
  --accent: #6e8efb;
  --accent-hover: #5a7df0;
  --radius: 8px;
  --radius-sm: 6px;
  --transition: 150ms ease;
}

html,
body {
  height: 100%;
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== Preview Area ===== */
.preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--bg-primary);
  min-width: 0;
  gap: 16px;
}

#preview-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  min-height: 0;
  position: relative;
  gap: 8px;
}

/* Nav Buttons */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  line-height: 38px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  z-index: 10;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  user-select: none;
}

.nav-prev {
  left: 8px;
}

.nav-next {
  right: 8px;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Drop Zone */
.drop-zone {
  width: 400px;
  height: 400px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(110, 142, 251, 0.05);
}

.drop-zone-content {
  text-align: center;
  color: var(--text-muted);
}

.drop-zone-content svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.drop-zone-content p {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.drop-zone-sub {
  font-size: 12px !important;
  font-weight: 400 !important;
  color: var(--text-muted) !important;
  margin-top: 4px;
}

/* Canvas Preview */
#preview-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Thumbnail Strip */
.thumbnail-strip {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  overflow-x: auto;
  width: 100%;
  flex-shrink: 0;
}

.thumbnail-strip::-webkit-scrollbar {
  height: 4px;
}

.thumbnail-strip::-webkit-scrollbar-track {
  background: transparent;
}

.thumbnail-strip::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.thumbnail-item {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: border-color var(--transition), opacity var(--transition);
  opacity: 0.6;
}

.thumbnail-item:hover {
  opacity: 0.85;
}

.thumbnail-item.active {
  border-color: var(--accent);
  opacity: 1;
}

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

.thumbnail-delete {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.thumbnail-item {
  position: relative;
}

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

.thumbnail-delete:hover {
  background: #e54;
}

/* ===== Settings Panel ===== */
.settings-panel {
  width: 320px;
  min-width: 320px;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-panel::-webkit-scrollbar {
  width: 4px;
}

.settings-panel::-webkit-scrollbar-track {
  background: transparent;
}

.settings-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.app-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* Info Line Rows */
.info-lines-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

.info-col-show,
.info-col-bold {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  width: 28px;
  flex-shrink: 0;
}

.info-line-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.info-line-row .info-show,
.info-line-row .info-bold {
  width: 28px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
  margin: 0;
  text-align: center;
}

.info-line-row label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  width: 90px;
  flex-shrink: 0;
}

.info-line-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.info-separator {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

/* Sections */
.settings-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
  border-bottom: none;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Preset Swatches */
.preset-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.preset-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  cursor: pointer;
  padding: 0;
  background: none;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.preset-swatch:hover {
  border-color: var(--text-muted);
  transform: scale(1.1);
}

.preset-swatch.active {
  border-color: var(--accent);
}

.swatch-bg {
  display: block;
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  border-radius: 50%;
}

.swatch-text {
  display: block;
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(128, 128, 128, 0.3);
}

/* Setting Rows */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.setting-row:last-child {
  margin-bottom: 0;
}

.setting-row label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  margin-right: 12px;
}

/* Color Input */
.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  padding: 2px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-hex {
  font-size: 12px;
  font-family: 'Inter', monospace;
  color: var(--text-muted);
  min-width: 60px;
}

/* Select */
select {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  min-width: 140px;
  transition: border-color var(--transition);
}

select:hover {
  border-color: var(--text-muted);
}

select:focus {
  border-color: var(--accent);
}

/* Text Input */
input[type="text"] {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 140px;
  transition: border-color var(--transition);
}

input[type="text"]:hover {
  border-color: var(--text-muted);
}

input[type="text"]:focus {
  border-color: var(--accent);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

.input-with-action {
  display: flex;
  gap: 4px;
  align-items: center;
}

.btn-apply-all {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-apply-all:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* Range */
.range-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

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

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-value {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
}

.btn-primary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-primary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-download {
  background: var(--accent);
  color: #fff;
  margin-top: 10px;
}

.btn-download:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-download:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-download-all {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  margin-top: 8px;
}

.btn-download-all:hover {
  background: var(--bg-hover);
  border-color: var(--accent-hover);
}

.file-name {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  word-break: break-all;
}

/* EXIF Fields */
.exif-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.exif-placeholder {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.exif-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}

.exif-label {
  color: var(--text-muted);
  font-size: 12px;
}

.exif-value {
  color: var(--text-primary);
  font-size: 13px;
  text-align: right;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}