:root {
  --dhl-yellow: #ffcc00;
  --dhl-red: #d40511;
  --dhl-red-dark: #b30410;
  --ink: #1f2430;
  --muted: #6b7280;
  --border: #e2d9a8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--dhl-yellow);
  color: var(--ink);
  min-height: 100vh;
}

/* DHL Express brand logo */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.brand img,
.brand svg {
  width: 220px;
  height: auto;
  display: block;
}

.admin-eye {
  position: fixed;
  top: 16px;
  right: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--dhl-red);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.admin-eye:hover {
  background: var(--dhl-red);
  color: #fff;
}

.card {
  max-width: 440px;
  margin: 64px auto;
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  border-top: 6px solid var(--dhl-red);
}

h1 {
  margin-top: 0;
  font-size: 1.5rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 10px;
}

input[type="text"],
input[type="file"] {
  padding: 10px;
  border: 1px solid #d9dce3;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}
input[type="text"]:focus,
input[type="file"]:focus {
  outline: none;
  border-color: var(--dhl-red);
  box-shadow: 0 0 0 3px rgba(212, 5, 17, 0.15);
}

button[type="submit"] {
  margin-top: 20px;
  padding: 12px;
  background: var(--dhl-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
button[type="submit"]:hover {
  background: var(--dhl-red-dark);
}
button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: default;
}

.preview {
  margin-top: 14px;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #eee;
}

/* Custom file picker (Latvian label, replaces native text) */
.file-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  cursor: pointer;
}
.file-picker-btn {
  flex: 0 0 auto;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
}
.file-picker:hover .file-picker-btn {
  background: #000;
}
.file-picker-text {
  color: var(--muted);
  font-size: 0.9rem;
}
.hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.preview-item {
  position: relative;
  width: 90px;
  height: 90px;
}
.preview-thumb {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #eee;
  display: block;
}
.preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--dhl-red);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.preview-remove:hover {
  background: var(--dhl-red-dark);
}

.message {
  margin: 12px 0 0;
  font-size: 0.9rem;
  min-height: 1.2em;
}
.message.error {
  color: var(--dhl-red);
}

/* Prominent success banner */
.success-banner {
  margin-top: 20px;
  padding: 18px 20px;
  background: var(--dhl-yellow);
  border: 2px solid var(--dhl-red);
  border-radius: 10px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.success-banner[hidden] {
  display: none;
}
.success-banner .check {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--dhl-red);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1rem;
}

/* Admin page */
.admin-wrap {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.link {
  color: var(--dhl-red);
  font-weight: 600;
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.grid .item {
  position: relative;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border-bottom: 4px solid var(--dhl-red);
}
.grid .item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.grid .item.selected {
  outline: 3px solid var(--dhl-red);
  outline-offset: -3px;
}
.item-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  padding: 4px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.item-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--dhl-red);
  cursor: pointer;
  margin: 0;
}

/* Admin selection toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.toolbar[hidden] {
  display: none;
}
.select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}
.select-all input {
  width: 20px;
  height: 20px;
  accent-color: var(--dhl-red);
  cursor: pointer;
  margin: 0;
}
.download-btn {
  background: var(--dhl-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.download-btn:hover {
  background: var(--dhl-red-dark);
}
.download-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.delete-btn {
  background: #fff;
  color: var(--dhl-red);
  border: 2px solid var(--dhl-red);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.delete-btn:hover {
  background: var(--dhl-red);
  color: #fff;
}
.delete-btn:disabled {
  opacity: 0.5;
  cursor: default;
  background: #fff;
  color: var(--dhl-red);
}
.grid .item .meta {
  padding: 10px 12px;
}
.grid .item .meta .name {
  font-weight: 600;
}
.grid .item .meta .date {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Lightbox / fullscreen viewer */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  z-index: 100;
  touch-action: pan-y;
}
.lightbox[hidden] {
  display: none;
}
.lightbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  color: #fff;
  gap: 12px;
}
.lightbox-caption {
  min-width: 0;
}
.lightbox-caption .lb-name {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lightbox-caption .lb-date {
  font-size: 0.8rem;
  opacity: 0.8;
}
.lightbox-counter {
  font-size: 0.9rem;
  opacity: 0.85;
  white-space: nowrap;
}
.lb-close {
  background: var(--dhl-red);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}
.lb-close:hover {
  background: var(--dhl-red-dark);
}

.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 8px;
}
.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px;
}
.lb-btn {
  background: var(--dhl-yellow);
  color: var(--ink);
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 120px;
}
.lb-btn:hover {
  background: #e6b800;
}
.lb-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (max-width: 520px) {
  .lb-btn {
    min-width: 0;
    flex: 1;
    padding: 14px 10px;
  }
}
