/* ============================================
   CAMERARIUM - DESIGN v9
   ============================================ */

:root {
  --bg: #1a1a1a; --bg-card: #2a2a2a; --bg-input: #1a1a1a;
  --text: #eee; --text-muted: #999;
  --accent: #ffb400; --accent-hover: #ffcc33;
  --border: #444; --border-light: #555;
  --danger: #d33; --success: #2d6a2d; --warning: #b8860b;
  --info: #3498db;
}

[data-theme="light"] {
  --bg: #f5f5f0; --bg-card: #ffffff; --bg-input: #ffffff;
  --text: #1a1a1a; --text-muted: #666;
  --border: #ddd; --border-light: #ccc;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  padding: 20px; min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  line-height: 1.5;
}

/* HEADER */
header {
  max-width: 1400px; margin: 0 auto 30px;
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 15px;
}
h1 { color: var(--accent); font-size: clamp(1.4em, 4vw, 2em); }

/* BUTTONS */
.btn {
  padding: 11px 22px; background: var(--accent);
  color: #1a1a1a; border: none; border-radius: 8px;
  cursor: pointer; font-weight: 600; font-size: 14px;
  text-decoration: none; display: inline-block;
  transition: 0.2s; font-family: inherit;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border-light); }
.btn.secondary:hover { background: var(--border); }
.btn.danger { background: var(--danger); color: white; }
.btn.info { background: var(--info); color: white; }

/* USER INFO */
.user-info {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap;
}
.user-info .username { color: var(--accent); font-weight: 600; }
.badge-admin {
  background: var(--danger); color: white;
  padding: 3px 10px; border-radius: 10px;
  font-size: 0.7em; font-weight: bold;
}

/* THEME TOGGLE */
.theme-toggle {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px;
  border-radius: 50px; cursor: pointer; font-size: 1.1em;
}

/* FILTERS */
.filters {
  display: flex; gap: 10px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 20px;
  background: var(--bg-card); padding: 15px;
  border-radius: 12px; border: 1px solid var(--border);
  max-width: 1400px; margin-left: auto; margin-right: auto;
}
.filters input, .filters select {
  padding: 10px 14px; background: var(--bg-input);
  border: 1px solid var(--border-light); color: var(--text);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  max-width: 200px;
}
.filters input:focus, .filters select:focus {
  outline: none; border-color: var(--accent);
}

/* STATS BAR */
.stats-bar {
  text-align: center; color: var(--text-muted);
  margin: 15px 0; font-size: 0.9em;
}

/* GALLERY */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px; max-width: 1400px; margin: 0 auto;
}

/* CARD */
.card {
  background: var(--bg-card); border-radius: 12px;
  overflow: hidden; border: 1px solid var(--border);
  transition: 0.25s; cursor: pointer;
  display: flex; flex-direction: column; position: relative;
}
.card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* ΔΙΟΡΘΩΣΗ: object-fit: contain + background */
.card-img {
  height: 250px; background: #111;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.card-img img {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform 0.3s;
  background: #111;
}
.card:hover .card-img img { transform: scale(1.05); }
.card-img .placeholder { font-size: 60px; color: #444; }
.card-count {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.7); color: white;
  padding: 3px 10px; border-radius: 12px;
  font-size: 0.75em; font-weight: 600;
}
.card-code {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(255,180,0,0.95); color: #1a1a1a;
  padding: 3px 10px; border-radius: 6px;
  font-size: 0.75em; font-weight: bold;
  font-family: monospace;
}
.card-body { padding: 15px; flex: 1; display: flex; flex-direction: column; }
.card-body h3 { color: var(--accent); font-size: 1.1em; margin-bottom: 4px; }
.card-body .model { font-size: 0.95em; margin-bottom: 8px; font-weight: 500; }
.card-body .meta {
  font-size: 0.8em; color: var(--text-muted);
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; flex-wrap: wrap; gap: 5px;
}

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px;
  font-size: 0.72em; font-weight: 600;
  background: var(--border); color: var(--text);
}
.badge.working { background: var(--success); color: white; }
.badge.broken { background: #7a2020; color: white; }
.badge.untested { background: var(--warning); color: white; }
.badge.mint { background: #27ae60; color: white; }
.badge.excellent { background: #2ecc71; color: white; }
.badge.good { background: #f1c40f; color: #1a1a1a; }
.badge.fair { background: #e67e22; color: white; }
.badge.poor { background: #c0392b; color: white; }

.card-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 12px; }
.card-actions a {
  flex: 1; text-align: center; padding: 8px;
  border-radius: 6px; font-size: 0.8em;
  text-decoration: none; background: var(--bg-input);
  color: var(--text); border: 1px solid var(--border);
  transition: 0.2s;
}
.card-actions a:hover { background: var(--border); }
.card-actions a.edit { background: var(--info); color: white; border-color: var(--info); }
.card-actions a.del { background: var(--danger); color: white; border-color: var(--danger); }

/* EMPTY */
.empty {
  text-align: center; color: var(--text-muted);
  padding: 60px 20px; grid-column: 1 / -1;
}

/* MESSAGES */
.msg {
  background: var(--success); color: white;
  padding: 12px 20px; border-radius: 8px;
  max-width: 1400px; margin: 0 auto 20px;
  text-align: center;
}
.msg.error { background: var(--danger); }

/* PAGINATION */
.pagination {
  display: flex; justify-content: center; gap: 6px;
  margin: 30px auto 10px; flex-wrap: wrap;
}
.pagination a, .pagination span {
  min-width: 40px; padding: 8px 12px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.9em; text-decoration: none;
  text-align: center; transition: 0.2s;
}
.pagination a:hover { background: var(--border); }
.pagination .active {
  background: var(--accent); color: #1a1a1a;
  border-color: var(--accent); font-weight: bold;
}
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* LIGHTBOX */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.95);
  display: none; align-items: center; justify-content: center;
  z-index: 2000; padding: 20px;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90%; max-height: 90%;
  object-fit: contain; border-radius: 8px;
}
.lightbox .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,180,0,0.9); color: #1a1a1a;
  border: none; width: 50px; height: 50px;
  border-radius: 50%; cursor: pointer;
  font-size: 1.5em; font-weight: bold;
  display: flex; align-items: center; justify-content: center;
}
.lightbox .nav:hover { background: var(--accent-hover); }
.lightbox .nav.prev { left: 20px; }
.lightbox .nav.next { right: 20px; }
.lightbox .close {
  position: absolute; top: 20px; right: 20px;
  background: var(--danger); color: white;
  border: none; width: 40px; height: 40px;
  border-radius: 50%; cursor: pointer; font-size: 1.2em;
}
.lightbox .counter {
  position: absolute; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7); color: white;
  padding: 8px 16px; border-radius: 20px;
  font-size: 0.9em;
}

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card); border-radius: 16px;
  max-width: 900px; width: 100%; max-height: 90vh;
  overflow-y: auto; border: 1px solid var(--border);
}
.modal-header {
  padding: 20px 25px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--bg-card); z-index: 1;
}
.modal-header h2 { color: var(--accent); font-size: 1.3em; }
.modal-close {
  background: transparent; border: none;
  color: var(--text); font-size: 1.5em; cursor: pointer;
}
.modal-body { padding: 25px; }

/* MODAL GALLERY */
.modal-gallery .main-img {
  width: 100%; max-height: 400px; object-fit: contain;
  background: #111; border-radius: 10px;
  margin-bottom: 10px; cursor: zoom-in;
}
.modal-gallery .thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
}
.modal-gallery .thumbs img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; transition: 0.2s;
}
.modal-gallery .thumbs img.active { border-color: var(--accent); }

/* DETAILS */
.detail-section-title {
  color: var(--accent); font-size: 0.8em; text-transform: uppercase;
  letter-spacing: 1px; margin: 20px 0 10px 0; font-weight: 600;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.detail-item {
  background: var(--bg); padding: 12px 15px;
  border-radius: 8px; border: 1px solid var(--border);
}
.detail-item .label {
  font-size: 0.72em; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.detail-item .value { font-size: 0.95em; font-weight: 500; }

/* RESPONSIVE */
@media (max-width: 600px) {
  body { padding: 12px; }
  .card-actions { flex-direction: column; }
  .filters input, .filters select { max-width: 100%; }
  .lightbox .nav { width: 40px; height: 40px; font-size: 1.2em; }
}