@font-face {
  font-family: 'BloomStamp';
  src: url('fonts/bloom-stamp.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --bg: #000000;
  --bg-card: #0a0a0a;
  --bg-card-hover: #111111;
  --bg-input: #0f0f0f;
  --border: rgba(255, 255, 255, 0.18);
  --border-light: rgba(255, 255, 255, 0.25);
  --border-soft: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --text-muted: #8a8a8a;
  --cream: #eae4d4;
  --cream-2: #e9e0d0;
  --warm: #65523c;
  --accent: #eae4d4;
  --accent-hover: #f5efe5;
  --pink: #ffabd2;
  --success: #4caf50;
  --error: #e53935;
  --warning: #ff9800;
  --radius: 10px;
  --radius-sm: 6px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

html, body {
  height: 100%;
  font-family: 'DM Sans', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 0.85rem; }

/* ---- BUTTONS ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--cream);
  color: #000;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled {
  background: #3a3a3a;
  color: #666;
  cursor: not-allowed;
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #43a047; }
.btn-success:disabled {
  background: #3a3a3a;
  color: #666;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-light);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--cream);
  color: var(--cream);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); }

.btn-icon {
  background: transparent;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 50%;
}
.btn-icon:hover {
  background: var(--bg-input);
  color: var(--text);
}

.btn-full { width: 100%; justify-content: center; }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-danger-ghost:hover { color: var(--error); }

/* ---- INPUTS ---- */

.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.input:focus { border-color: var(--cream); }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 8px 0;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cream);
  cursor: pointer;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ---- LOGIN ---- */

#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo {
  font-family: 'Asul', Georgia, serif;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 10px;
  color: var(--cream);
  margin-bottom: 4px;
}

.login-subtitle {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 6px;
  color: var(--text-muted);
  margin-bottom: 48px;
  text-transform: uppercase;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#login-form input {
  text-align: center;
  font-size: 1rem;
  padding: 14px;
}

.error-text {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 10px;
}

/* ---- HEADER ---- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.header-title {
  font-family: 'Asul', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--cream);
}
.header-title span {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- SETTINGS PANEL ---- */

.settings-panel {
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease;
  max-height: 500px;
  opacity: 1;
}

.settings-panel.collapsed {
  max-height: 0;
  opacity: 0;
}

.settings-inner {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section h3 {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.settings-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.settings-row .flex-1 { flex: 1; min-width: 200px; }
.settings-row .settings-section { min-width: 160px; }

/* ---- LOGO GRID ---- */

.logo-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.logo-item {
  position: relative;
  width: 100px;
  height: 70px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  background: #222;
}

.logo-item:hover { border-color: var(--border-light); }

.logo-item.selected {
  border-color: var(--cream);
  box-shadow: 0 0 0 1px var(--cream);
}

.logo-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.logo-item .logo-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cream);
  display: none;
  align-items: center;
  justify-content: center;
}
.logo-item.selected .logo-check { display: flex; }

.logo-item .logo-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 4px;
  font-size: 0.65rem;
  text-align: center;
  background: rgba(0,0,0,0.7);
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- TOGGLE BUTTONS ---- */

.toggle-btns {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  padding: 8px 18px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.toggle-btn.active {
  background: var(--cream);
  border-color: var(--cream);
  color: #000;
}

.scritte-options {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---- UPLOAD ZONE ---- */

.upload-section {
  padding: 24px;
}

.drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  transition: all 0.25s;
  cursor: pointer;
}

.drop-zone.drag-over {
  border-color: var(--cream);
  background: rgba(234, 228, 212, 0.05);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.drop-zone-content svg { opacity: 0.4; }

.drop-zone-content p { font-size: 0.95rem; }

.upload-btn { margin-top: 8px; }

/* ---- ACTIONS BAR ---- */

.actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.actions-left {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.counter {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---- PHOTO GRID ---- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 24px;
}

.photo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.photo-card:hover { border-color: var(--border-light); }

.photo-card.status-done { border-color: var(--success); }
.photo-card.status-error { border-color: var(--error); }
.photo-card.status-processing { border-color: var(--cream); }

.photo-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  background: #111;
  overflow: hidden;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge-portrait {
  background: rgba(76, 175, 80, 0.85);
  color: #fff;
}

.badge-landscape {
  background: rgba(33, 150, 243, 0.85);
  color: #fff;
}

.photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #aaa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}
.photo-remove:hover {
  background: var(--error);
  color: #fff;
}

.photo-status-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.photo-card.status-processing .photo-status-overlay,
.photo-card.status-done .photo-status-overlay {
  opacity: 1;
}

.status-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-icon.spinner {
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--cream);
  animation: spin 0.8s linear infinite;
}

.status-icon.check {
  background: var(--success);
}

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

.photo-info {
  padding: 10px 12px;
}

.photo-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.photo-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.photo-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cream), var(--cream-2));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.photo-progress-bar.complete {
  background: var(--success);
}

.photo-progress-bar.error {
  background: var(--error);
}

.photo-status-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.photo-actions {
  display: flex;
  gap: 6px;
}

.photo-actions .btn {
  padding: 5px 10px;
  font-size: 0.75rem;
}

/* ---- PROCESSING OVERLAY ---- */

.processing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.processing-modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  min-width: 300px;
}

/* ---- RESPONSIVE ---- */

@media (max-width: 768px) {
  .app-header { padding: 12px 16px; }
  .settings-inner { padding: 16px; }
  .settings-row { flex-direction: column; }
  .upload-section { padding: 16px; }
  .drop-zone { padding: 32px 16px; }
  .photo-grid { padding: 16px; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .actions-bar { padding: 12px 16px; }
  .actions-left { width: 100%; }
  .actions-left .btn { flex: 1; justify-content: center; font-size: 0.8rem; padding: 10px 8px; }
}

@media (max-width: 480px) {
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .header-title { font-size: 0.95rem; letter-spacing: 2px; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
