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

:root {
  --bg: #0e0e0e;
  --surface: #181818;
  --surface-2: #222;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #c9a96e;
  --accent-dim: #a08045;
  --danger: #c44;
  --success: #4a9;
  --radius: 10px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dim); }

/* ---- Nav ---- */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(14,14,14,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: .75rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem;
}
.nav-brand {
  font-size: 1.3rem; font-weight: 300; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent);
}
.nav-links { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.nav-links a, .nav-links button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: .88rem; font-family: inherit; padding: .4rem .7rem;
  border-radius: 6px; transition: all .2s;
}
.nav-links a:hover, .nav-links button:hover { color: var(--text); background: var(--surface-2); }
.nav-links .active { color: var(--accent); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.3rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font-size: .88rem; font-family: inherit; transition: all .2s;
}
.btn:hover { border-color: var(--accent-dim); }
.btn-primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; font-size: .78rem; color: var(--muted);
  margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .04em;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); padding: .6rem .9rem;
  border-radius: 8px; font-size: .9rem; font-family: inherit; outline: none;
  transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 90px; }

.form-card {
  max-width: 480px; margin: 3rem auto; padding: 2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.form-card h2 {
  font-size: 1.3rem; font-weight: 400; color: var(--accent); margin-bottom: 1.5rem;
}
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

.form-error { color: var(--danger); font-size: .85rem; margin-top: .5rem; }

/* ---- Gallery Grid ---- */
.page { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 400; }

.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.5rem; }
.filters input, .filters select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: .5rem .85rem; border-radius: 6px; font-size: .85rem; outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--accent); }
.filters input { width: 220px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden; cursor: pointer;
  transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
  border-color: rgba(201,169,110,.3);
}
.card img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #222;
  transition: transform .5s ease;
}
.card:hover img { transform: scale(1.04); }
.card-body { padding: 1rem 1.1rem; }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: .2rem; }
.card-artist { font-size: .85rem; color: var(--accent); margin-bottom: .3rem; }
.card-price { font-size: .95rem; font-weight: 600; color: var(--success); }
.card-meta { font-size: .75rem; color: var(--muted); display: flex; gap: .75rem; margin-top: .3rem; }
.card-buy-btn { width: 100%; justify-content: center; margin-top: .65rem; }

/* Sold card styles */
.card-img-wrap { position: relative; overflow: hidden; }
.card-sold { opacity: .75; }
.card-sold:hover { opacity: .85; }
.card-sold img { filter: grayscale(.4); }
.sold-badge {
  position: absolute; top: 1rem; right: -2rem;
  background: var(--danger); color: #fff;
  font-size: .7rem; font-weight: 800; letter-spacing: .12em;
  padding: .35rem 2.5rem;
  transform: rotate(35deg);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.price-sold { color: var(--danger); font-weight: 700; }

/* Section tabs for gallery */
.gallery-tabs {
  display: flex; gap: .5rem; margin-bottom: 1.5rem;
}
.gallery-tab {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  padding: .5rem 1.2rem; border-radius: 8px; cursor: pointer;
  font-size: .88rem; font-family: inherit; transition: all .2s;
}
.gallery-tab:hover { border-color: var(--accent-dim); color: var(--text); }
.gallery-tab.active { border-color: var(--accent); color: var(--accent); background: rgba(201,169,110,.08); }
.gallery-tab .count {
  display: inline-block; margin-left: .4rem; font-size: .72rem;
  background: rgba(255,255,255,.08); padding: .1rem .45rem; border-radius: 10px;
}

.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 4rem 1rem;
  color: var(--muted); font-size: 1.05rem;
}

/* ---- Painting Detail ---- */
.painting-detail {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem;
  max-width: 1100px; margin: 2rem auto; padding: 0 2rem;
}
.painting-detail img {
  width: 100%; border-radius: var(--radius); background: #111;
}
.painting-info h1 { font-size: 1.8rem; margin-bottom: .3rem; }
.painting-info .artist { color: var(--accent); font-size: 1.05rem; margin-bottom: 1rem; }
.painting-info .price { font-size: 1.6rem; font-weight: 700; color: var(--success); margin-bottom: 1rem; }
.painting-info .details { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; line-height: 1.8; }
.painting-info .description { color: #bbb; font-size: .95rem; line-height: 1.7; margin-bottom: 1.5rem; }

/* ---- Dashboard ---- */
.dashboard { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.dashboard h1 { font-size: 1.5rem; font-weight: 400; margin-bottom: .5rem; }
.dashboard .subtitle { color: var(--muted); margin-bottom: 2rem; }

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
}
.stat-card .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 1.6rem; font-weight: 600; margin-top: .3rem; }

.section-title { font-size: 1.1rem; margin: 2rem 0 1rem; color: var(--accent); font-weight: 400; }

.order-row {
  display: flex; gap: 1rem; align-items: center; padding: 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: .75rem;
}
.order-row img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }
.order-info { flex: 1; }
.order-info .title { font-weight: 600; }
.order-info .meta { font-size: .8rem; color: var(--muted); }
.order-status { font-size: .8rem; padding: .25rem .7rem; border-radius: 20px; font-weight: 600; }
.status-paid { background: rgba(68,170,136,.15); color: var(--success); }
.status-shipped { background: rgba(100,150,255,.15); color: #6496ff; }
.status-pending { background: rgba(200,160,60,.15); color: var(--accent); }

/* ---- Terms ---- */
.terms { max-width: 800px; margin: 2rem auto; padding: 2rem; }
.terms h1 { font-size: 1.6rem; color: var(--accent); margin-bottom: 1.5rem; font-weight: 400; }
.terms h2 { font-size: 1.1rem; margin: 1.5rem 0 .75rem; }
.terms p, .terms li { color: #bbb; font-size: .92rem; line-height: 1.8; margin-bottom: .75rem; }
.terms ul { padding-left: 1.5rem; }
.terms .highlight {
  background: rgba(201,169,110,.1); border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem; border-radius: 0 8px 8px 0; margin: 1rem 0;
}

/* ---- Back to top button ---- */
.back-to-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--accent); font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s, background .2s;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--accent); color: #111; border-color: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  nav { padding: .6rem 1rem; }
  .page { padding: 1rem; }
  .painting-detail { grid-template-columns: 1fr; gap: 1.5rem; }
  .form-row { flex-direction: column; gap: 0; }
}
