:root {
  --bg-color: #000;
  --text-color: #fff;
  --accent-color: #ff3b30;
  --nav-bg: #111;
  --nav-active: #333;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* Tablet Navigation */
.top-nav {
  display: flex;
  background: var(--nav-bg);
  overflow-x: auto;
  padding: 10px;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.top-nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  padding: 15px 30px;
  background: #222;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}
.nav-item.active {
  background: var(--nav-active);
  color: var(--accent-color);
  border: 2px solid var(--accent-color);
}

/* Grid layout for 2x3 */
.grid-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 15px;
  padding: 15px;
  overflow: hidden; /* Hide anything beyond the 6 items */
}

.grid-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a1a;
  cursor: pointer;
}
.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* preserve aspect ratio without distortion */
  display: block;
}

/* Pagination controls (if more than 6 images) */
.pagination {
  display: none; /* hidden by default */
  justify-content: center;
  align-items: center;
  padding: 10px;
  gap: 20px;
  background: var(--bg-color);
}
.pagination button {
  background: #333;
  color: #fff;
  border: none;
  padding: 15px 30px;
  font-size: 1.2rem;
  border-radius: 8px;
}
.pagination button:disabled {
  opacity: 0.5;
}

/* Fullscreen Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 1);
  z-index: 1000;
  display: none; /* hidden by default */
  justify-content: center;
  align-items: center;
}
.lightbox.active {
  display: flex;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* preserve aspect ratio completely */
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.5);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 1001;
}

/* Admin Dashboard Specifics */
.admin-body {
  overflow-y: auto;
  height: auto;
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
  display: block;
}

.admin-header {
  margin-bottom: 20px;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
}

.admin-section {
  background: #111;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.admin-section h2 {
  margin-bottom: 15px;
}

input, select, button {
  padding: 10px;
  margin: 5px 0;
  border-radius: 4px;
  border: 1px solid #444;
  background: #222;
  color: white;
  font-size: 1rem;
}
button {
  cursor: pointer;
  background: #333;
}
button:hover {
  background: #444;
}
button.danger {
  background: #600;
  border-color: #f00;
}

.upload-dropzone {
  border: 2px dashed #666;
  padding: 40px;
  text-align: center;
  border-radius: 8px;
  margin: 15px 0;
  transition: background 0.3s;
}
.upload-dropzone.dragover {
  background: #222;
  border-color: var(--accent-color);
}

.auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}
.auth-box {
  background: #111;
  padding: 30px;
  border-radius: 8px;
  text-align: center;
}
.hidden { display: none !important; }

.messages {
  margin: 10px 0;
  padding: 10px;
  border-radius: 4px;
}
.messages.error { background: #500; color: #fcc; }
.messages.success { background: #050; color: #cfc; }
.messages.info { background: #005; color: #ccf; }

.image-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #222;
  margin-bottom: 5px;
  border-radius: 4px;
}
.image-list-item img {
  height: 50px;
  width: 50px;
  object-fit: cover;
  margin-right: 15px;
}
