/* Lost Place Recordings – Admin Dashboard */

:root {
  --bg-dark: #1a1a1e;
  --bg-card: #242429;
  --bg-input: #2d2d33;
  --border: #3a3a42;
  --text: #e8e8ed;
  --text-muted: #9a9aa8;
  --accent: #c9a227;
  --accent-hover: #dbb42e;
  --danger: #d64545;
  --danger-hover: #e85555;
  --success: #3d9b6e;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --font-sans: "DM Sans", "Segoe UI", system-ui, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header */
.header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Login */
.login {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-width: 420px;
}

.login p:first-of-type {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.login-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}

.login-form input {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.login-form input::placeholder {
  color: var(--text-muted);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-form button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

.login-form button:hover {
  background: var(--accent-hover);
}

.login-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.login-error.hidden {
  display: none;
}

/* Dashboard */
.dashboard-section {
  margin-top: 2rem;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.btn-logout {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

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

/* Cards für Bereiche */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

.card-title {
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  text-align: left;
  padding: 0.75rem 1.25rem;
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody td {
  padding: 0.875rem 1.25rem;
  color: var(--text);
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-pending {
  background: rgba(201, 162, 39, 0.2);
  color: var(--accent);
}

.status-paid {
  background: rgba(61, 155, 110, 0.2);
  color: var(--success);
}

.status-shipped {
  background: rgba(100, 120, 200, 0.2);
  color: #8496e0;
}

/* Products block header */
.products-block {
  margin-bottom: 2rem;
}

.block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.block-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.btn-primary {
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Table actions */
.actions-cell {
  white-space: nowrap;
}

.btn-table {
  padding: 0.35rem 0.6rem;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-right: 0.35rem;
  transition: opacity 0.2s;
}

.btn-table:hover {
  opacity: 0.9;
}

.btn-edit {
  background: rgba(201, 162, 39, 0.25);
  color: var(--accent);
}

.btn-delete {
  background: rgba(214, 69, 69, 0.2);
  color: var(--danger);
}

.btn-ship {
  background: rgba(61, 155, 110, 0.25);
  color: var(--success);
}

.address-cell {
  max-width: 180px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.items-cell {
  max-width: 200px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.table-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  vertical-align: middle;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.modal-box {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text);
}

/* Product form */
.product-form {
  padding: 1.25rem;
}

.form-row {
  margin-bottom: 1rem;
}

.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.product-form input[type="text"],
.product-form input[type="number"],
.product-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.product-form input:focus,
.product-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.product-form textarea {
  resize: vertical;
  min-height: 60px;
}

.image-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.image-upload-row input[type="file"] {
  flex: 0 0 auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.image-upload-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.image-upload-row #productImageUrl {
  flex: 1;
  min-width: 120px;
}

.image-preview {
  margin-top: 0.5rem;
  min-height: 0;
}

.image-preview-img {
  max-width: 120px;
  max-height: 120px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.form-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.form-error.hidden {
  display: none;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Empty / loading states */
.empty-state,
.error-state {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.error-state {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
  .wrapper {
    padding: 1.25rem 1rem;
  }

  .login-form {
    flex-direction: column;
  }

  .login-form input {
    min-width: 100%;
  }

  thead th,
  tbody td {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }
}
