/*
 * assets/css/gallery.css
 * ----------------------
 * Public gallery styles.
 * Based on the approved DESIGN.html.
 *
 * Changes from original:
 *  - Language toggle moved left of nav links, styled discreetly
 *  - Nav links: icons removed (SVG hidden via CSS)
 *  - Filter bar: smaller padding/font to match admin panel neatness
 *  - Art card image: padding added so painting never touches card edges
 *  - Detail modal: larger (90vw/85vh), image padded inside its frame
 */

/* =====================================================
   DESIGN TOKENS
   ===================================================== */
:root {
  --bg:           #f7f7f7;
  --card-max:     320px;
  --gap:          24px;
  --page-padding: 40px;
  --radius:       8px;
  --black:        #000;

  --w-3cols: calc((var(--card-max) * 3) + (var(--gap) * 2));
  --w-2cols: calc((var(--card-max) * 2) + (var(--gap) * 1));
  --w-1col:  var(--card-max);
}

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

html, body {
  margin: 0;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: #222;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

/* =====================================================
   HEADER
   ===================================================== */
header {
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--page-padding);
  position: sticky;
  top: 0;
  z-index: 50;
}

header h1 { margin: 0; font-size: 1.15rem; font-weight: 600; }

nav { display: flex; gap: 10px; align-items: center; }

/* 1. Language toggle — now BEFORE the nav links, discreet style */
.lang-toggle {
  display: flex;
  gap: 2px;
  align-items: center;
  margin-right: 6px;   /* small gap before the main nav buttons */
}
.lang-btn {
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #999;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background .15s ease, color .15s ease;
}
.lang-btn:hover  { background: #f0f0f0; color: #444; }
.lang-btn.active { background: #eee; color: #222; }

/* 2. Nav links — no icons (SVG hidden), text only */
.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--black);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: transform .18s ease, background .18s ease;
  text-decoration: none;
}
.nav-link:hover { transform: translateY(-2px); background: #111; }

/* Hide SVG icons inside nav links */
.nav-link svg { display: none; }

/* Hamburger */
.hamburger {
  display: none;
  width: 22px;
  gap: 4px;
  cursor: pointer;
  flex-direction: column;
}
.hamburger span {
  height: 2px;
  background: #000;
  border-radius: 2px;
  display: block;
  transition: all .28s ease;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translateY(6px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translateY(-6px); }

/* =====================================================
   FILTER BAR
   3. Smaller / neater — matches admin panel style
   ===================================================== */
.filter-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 40;
  margin-top: -6px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: var(--w-3cols);
  padding: 10px 16px;          /* reduced from 14px 20px */
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  border-radius: 10px;
}

.filter-bar input,
.filter-bar select {
  font-size: 0.88rem;          /* reduced from 0.95rem */
  padding: 8px 12px;           /* reduced from 10px 14px */
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  font-family: inherit;
  transition: border-color .2s ease;
}
.filter-bar input              { flex: 2; }
.filter-bar select             { flex: .8; min-width: 120px; appearance: none; }
.filter-bar input:focus,
.filter-bar select:focus       { border-color: #000; outline: none; }

/* =====================================================
   GALLERY GRID
   ===================================================== */
.gallery {
  width: 100%;
  max-width: var(--w-3cols);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  padding: var(--page-padding);
  margin: 20px auto 60px;
  justify-content: center;
}

.art-item {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  transition: transform .25s cubic-bezier(.2,.9,.2,1), box-shadow .25s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.art-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

/* 4. Image area — padding so painting never touches card edges */
.art-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;               /* breathing room on all sides */
}
.art-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}

.art-media--placeholder {
  background: #ebebeb;
  color: #bbb;
  font-size: 2rem;
}

.art-info { padding: 12px 14px; border-top: 1px solid #eee; text-align: center; margin-top: auto; }
.art-info h2    { margin: 0; font-size: 1rem; font-weight: 600; }
.art-info .meta { color: #666; margin-top: 4px; font-size: 0.88rem; }
.art-info .price {
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #222;
}
.art-info .price--sold { color: #999; font-weight: 400; }

/* =====================================================
   LOADING & EMPTY STATES
   ===================================================== */
.loading-indicator,
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 1rem;
}

/* =====================================================
   FOOTER
   ===================================================== */
footer {
  border-top: 1px solid #ddd;
  text-align: center;
  padding: 18px 10px;
  background: #fff;
  color: #555;
  font-size: 0.9rem;
  margin-top: auto;
}

/* =====================================================
   MODALS — base styles
   ===================================================== */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  z-index: 200;
  padding: 20px;              /* prevent modal touching screen edges */
}
.modal.show { opacity: 1; pointer-events: auto; }

.modal-content {
  background: #fff;
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  max-width: 500px;
  width: 90%;
  text-align: center;
  position: relative;
  animation: fadeInUp .4s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes fadeInUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.close-modal {
  position: absolute;
  right: 16px; top: 10px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #444;
  cursor: pointer;
  transition: color .2s ease;
  line-height: 1;
}
.close-modal:hover { color: #000; }

.modal-content h2 { margin: 0; font-size: 1.3rem; font-weight: 600; }
.modal-content p  { color: #555; margin-top: 12px; line-height: 1.5; font-size: 0.95rem; }

/* About modal */
.about-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 18px;
  border: 3px solid #f0f0f0;
  display: block;
}
.about-photo--placeholder {
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.about-photo--placeholder svg { width: 60px; height: 60px; fill: #ccc; }

/* Contact modal */
.contact-info {
  text-align: left;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #444;
  font-size: 0.95rem;
}

/* Login modal */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.login-form input {
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
}
.login-form input:focus { border-color: #000; outline: none; }
.login-form button {
  background: #000;
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
}
.login-form button:hover    { background: #333; }
.login-form button:disabled { background: #999; cursor: wait; }

.login-error {
  color: #c0392b;
  font-size: 0.9rem;
  text-align: left;
  padding: 8px 12px;
  background: #fdf0ef;
  border-radius: 6px;
  border-left: 3px solid #c0392b;
}

/* =====================================================
   DETAIL MODAL
   5. Much larger — 92vw wide, 88vh tall, image padded
   ===================================================== */
.modal-content--detail {
  max-width: 1100px;           /* wide enough for large screens */
  width: 92vw;                 /* fills most of the viewport */
  max-height: 88vh;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 32px;
}

/* Side-by-side layout on wider screens */
@media (min-width: 640px) {
  .modal-content--detail {
    flex-direction: row;
    align-items: flex-start;
  }
}

/* Image section — takes 60% of modal width */
.detail-images {
  flex: 6;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* 5. Image frame — padded so painting never touches the frame edges */
.detail-main-image {
  width: 100%;
  background: #f5f5f5;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  padding: 16px;               /* frame breathing room */
}
.detail-main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}

/* Thumbnail strip */
.detail-thumbs { display: flex; gap: 8px; }
.detail-thumb {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s ease;
  flex-shrink: 0;
  padding: 3px;                /* small padding inside thumb frame too */
  background: #f5f5f5;
}
.detail-thumb.active { border-color: #000; }
.detail-thumb:hover  { border-color: #888; }
.detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}

/* Metadata section — takes 40% */
.detail-meta {
  flex: 4;
  min-width: 220px;
}
.detail-meta h2 {
  margin: 0 0 16px;
  font-size: 1.3rem;
  font-weight: 600;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.detail-table th,
.detail-table td {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}
.detail-table th {
  color: #888;
  font-weight: 500;
  width: 40%;
  padding-right: 12px;
}
.detail-table td { color: #222; }
.detail-table tr:last-child th,
.detail-table tr:last-child td { border-bottom: none; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1020px) {
  .gallery    { max-width: var(--w-2cols); grid-template-columns: repeat(2, 1fr); }
  .filter-bar { max-width: var(--w-2cols); }
}

@media (max-width: 720px) {
  nav {
    display: none;
    position: absolute;
    top: 60px;
    right: var(--page-padding);
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-direction: column;
    padding: 10px;
    border-radius: 8px;
  }
  nav.show   { display: flex; }
  .hamburger { display: flex; }
  .filter-bar { flex-direction: column; align-items: stretch; }

  /* On mobile detail modal stacks vertically, image full width */
  .modal-content--detail {
    width: 96vw;
    max-height: 92vh;
    padding: 20px;
  }
  .detail-meta { min-width: 0; }
}

@media (max-width: 680px) {
  .gallery    { max-width: var(--w-1col); grid-template-columns: 1fr; }
  .filter-bar { max-width: var(--w-1col); }
}

@media (max-width: 480px) {
  .modal-content        { padding: 24px 20px; }
  .about-photo          { width: 90px; height: 90px; }
  .modal-content--detail { gap: 16px; }
  .detail-table th,
  .detail-table td      { font-size: 0.85rem; }
}
