/* ============================================
   TBS Prints — Textile Print Archive
   Clean, minimal, Kinfolk/HAY aesthetic
   ============================================ */

:root {
    --black: #111;
    --dark: #1a1a1a;
    --mid: #666;
    --light: #999;
    --border: #e5e5e0;
    --bg: #faf9f7;
    --bg-warm: #f5f4f0;
    --white: #fff;
    --accent: #111;
    --reserved: #c9a96e;
    --sold: #b55;
    --radius: 12px;
    --radius-lg: 20px;
    --font: 'Inter', -apple-system, sans-serif;
    --heading: 'Space Grotesk', sans-serif;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    color: var(--black);
    background: var(--bg);
    line-height: 1.5;
    min-height: 100vh;
}

#app { min-height: 100vh; }

/* Typography */
h1, h2, h3 { font-family: var(--heading); font-weight: 500; letter-spacing: -0.03em; }
h1 { font-size: 2.5rem; line-height: 1.1; }
h2 { font-size: 1.75rem; line-height: 1.2; }
h3 { font-size: 1.125rem; }

a { color: inherit; text-decoration: none; }

/* ---- NAV ---- */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: rgba(250, 249, 247, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 1400px; margin: 0 auto;
    padding: 0 2rem;
    height: 64px;
    display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
    font-family: var(--heading);
    font-size: 1.125rem; font-weight: 600;
    letter-spacing: -0.04em;
    display: flex; align-items: center; gap: 0.625rem;
}
.nav-logo-mark {
    width: 32px; height: 32px;
    background: var(--black); color: var(--white);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.875rem; font-weight: 600;
}
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-link {
    font-size: 0.8125rem; font-weight: 500;
    color: var(--mid); cursor: pointer;
    transition: color var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--black); }
.nav-user {
    font-size: 0.75rem; color: var(--light);
    display: flex; align-items: center; gap: 0.75rem;
}
.nav-logout {
    cursor: pointer; color: var(--mid);
    transition: color var(--transition);
}
.nav-logout:hover { color: var(--black); }

/* ---- LOGIN ---- */
.login-page {
    min-height: 100vh;
    display: flex;
}
.login-visual {
    flex: 1;
    background: var(--dark);
    position: relative; overflow: hidden;
    display: flex; align-items: flex-end;
    padding: 3rem;
}
.login-visual-text {
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem; line-height: 1.6;
    max-width: 360px;
}
.login-visual-text strong {
    display: block; color: #fff;
    font-family: var(--heading);
    font-size: 1.5rem; font-weight: 500;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}
.login-form-side {
    width: 480px; min-width: 380px;
    display: flex; flex-direction: column;
    justify-content: center;
    padding: 3rem 3.5rem;
    background: var(--white);
}
.login-form-side h1 {
    font-size: 1.75rem; margin-bottom: 0.5rem;
}
.login-subtitle {
    color: var(--mid); font-size: 0.875rem;
    margin-bottom: 2.5rem;
}
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block; font-size: 0.75rem; font-weight: 500;
    color: var(--mid); margin-bottom: 0.375rem;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.form-input {
    width: 100%; padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font); font-size: 0.9375rem;
    background: var(--bg);
    transition: border-color var(--transition);
    outline: none;
}
.form-input:focus { border-color: var(--black); }
.form-error {
    color: var(--sold); font-size: 0.8125rem;
    margin-top: 0.5rem; display: none;
}
.form-error.show { display: block; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-family: var(--font); font-size: 0.875rem; font-weight: 500;
    border: none; cursor: pointer;
    transition: all var(--transition);
}
.btn-primary {
    background: var(--black); color: var(--white);
    width: 100%; padding: 0.875rem;
}
.btn-primary:hover { background: #333; }
.btn-secondary {
    background: var(--bg-warm); color: var(--black);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-small { padding: 0.5rem 1rem; font-size: 0.8125rem; }
.btn-ghost {
    background: none; color: var(--mid);
    padding: 0.5rem 0.75rem;
}
.btn-ghost:hover { color: var(--black); }

/* ---- MAIN LAYOUT ---- */
.main { padding-top: 64px; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 2rem; }

/* ---- HERO SECTION ---- */
.hero-section {
    padding: 3rem 0 2rem;
}
.hero-title {
    font-size: 3rem; margin-bottom: 0.5rem;
}
.hero-subtitle {
    color: var(--mid); font-size: 1rem;
    max-width: 480px;
}

/* ---- FILTER BAR ---- */
.filter-bar {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.filter-group {
    display: flex; align-items: center; gap: 0.375rem;
}
.filter-label {
    font-size: 0.6875rem; font-weight: 500;
    color: var(--light); text-transform: uppercase;
    letter-spacing: 0.06em; margin-right: 0.25rem;
}
.filter-pill {
    padding: 0.375rem 0.875rem;
    border-radius: 100px;
    font-size: 0.8125rem; font-weight: 400;
    color: var(--mid); background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}
.filter-pill:hover { color: var(--black); border-color: var(--light); }
.filter-pill.active {
    background: var(--black); color: var(--white);
    border-color: var(--black);
}
.filter-separator {
    width: 1px; height: 24px;
    background: var(--border); margin: 0 0.5rem;
}
.filter-count {
    margin-left: auto;
    font-size: 0.8125rem; color: var(--light);
}

/* ---- DESSIN GRID ---- */
.dessin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0 4rem;
}
.dessin-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--white);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}
.dessin-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -12px rgba(0,0,0,0.1);
}
.dessin-card.reserved, .dessin-card.sold {
    pointer-events: auto;
}
.dessin-card.reserved .dessin-img,
.dessin-card.sold .dessin-img {
    filter: grayscale(0.8) opacity(0.4);
}
.dessin-card.reserved:hover, .dessin-card.sold:hover {
    transform: none;
    box-shadow: none;
}
.dessin-img-wrap {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}
.dessin-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, filter var(--transition);
}
.dessin-card:hover .dessin-img { transform: scale(1.03); }
.dessin-card.reserved:hover .dessin-img,
.dessin-card.sold:hover .dessin-img { transform: none; }
.dessin-badge {
    position: absolute; top: 0.75rem; right: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.6875rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.dessin-badge.reserved-badge {
    background: var(--reserved); color: var(--white);
}
.dessin-badge.sold-badge {
    background: var(--sold); color: var(--white);
}
.dessin-info {
    padding: 0.875rem 1rem;
}
.dessin-name {
    font-size: 0.8125rem; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dessin-meta {
    font-size: 0.75rem; color: var(--light);
    margin-top: 0.125rem;
}

/* ---- LIGHTBOX ---- */
.lightbox {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox-inner {
    display: flex; gap: 0;
    max-width: 1100px; width: 95vw;
    max-height: 90vh;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}
.lightbox.open .lightbox-inner { transform: scale(1); }
.lightbox-image {
    flex: 1; min-width: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-warm);
    padding: 1.5rem;
}
.lightbox-image img {
    max-width: 100%; max-height: 80vh;
    object-fit: contain; border-radius: var(--radius);
}
.lightbox-sidebar {
    width: 320px; padding: 2rem;
    display: flex; flex-direction: column;
    border-left: 1px solid var(--border);
}
.lightbox-close {
    position: absolute; top: 1rem; right: 1rem;
    width: 40px; height: 40px;
    border-radius: 50%; border: none;
    background: rgba(255,255,255,0.1); color: #fff;
    font-size: 1.25rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
.lightbox-title {
    font-size: 1.25rem; margin-bottom: 0.25rem;
}
.lightbox-meta {
    color: var(--mid); font-size: 0.875rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.lightbox-actions { margin-top: auto; display: flex; flex-direction: column; gap: 0.75rem; }

/* ---- COLLECTIONS PANEL ---- */
.collections-panel {
    position: fixed; top: 64px; right: 0; bottom: 0;
    width: 360px; z-index: 150;
    background: var(--white);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 40px rgba(0,0,0,0.06);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex; flex-direction: column;
}
.collections-panel.open { transform: translateX(0); }
.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.panel-header h2 { font-size: 1.125rem; }
.panel-body { flex: 1; overflow-y: auto; padding: 1rem 1.5rem; }
.panel-footer { padding: 1.5rem; border-top: 1px solid var(--border); }

.collection-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}
.collection-item:hover { background: var(--bg); margin: 0 -1.5rem; padding: 0.75rem 1.5rem; }
.collection-name { font-size: 0.9375rem; font-weight: 500; }
.collection-count { font-size: 0.75rem; color: var(--light); }

/* Collection detail */
.collection-dessins {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem 0;
}

/* ---- RESERVATION BUTTON ---- */
.btn-reserve {
    background: var(--black); color: var(--white);
    width: 100%; padding: 0.875rem;
    border-radius: var(--radius);
    font-weight: 500;
}
.btn-reserve:hover { background: #333; }
.btn-reserve:disabled {
    background: var(--border); color: var(--light);
    cursor: not-allowed;
}

/* Select for add-to-collection */
.add-to-collection {
    position: relative;
}
.add-to-collection select {
    width: 100%; padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font); font-size: 0.875rem;
    background: var(--bg);
    appearance: none; cursor: pointer;
    outline: none;
}

/* ---- TOAST ---- */
.toast {
    position: fixed; bottom: 2rem; left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.75rem 1.5rem;
    background: var(--black); color: var(--white);
    border-radius: var(--radius);
    font-size: 0.875rem; font-weight: 500;
    opacity: 0; pointer-events: none;
    transition: all 0.3s ease;
    z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center; padding: 4rem 2rem;
    color: var(--light);
}
.empty-state h3 { color: var(--mid); margin-bottom: 0.5rem; }

/* ---- LOADING ---- */
.loading {
    display: flex; align-items: center; justify-content: center;
    padding: 4rem; color: var(--light);
}

/* ---- RESERVATIONS VIEW ---- */
.reservation-list { display: flex; flex-direction: column; gap: 1rem; padding: 2rem 0; }
.reservation-card {
    display: flex; gap: 1.25rem;
    padding: 1.25rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.reservation-thumb {
    width: 80px; height: 80px;
    border-radius: var(--radius);
    object-fit: cover;
}
.reservation-info { flex: 1; }
.reservation-name { font-weight: 500; margin-bottom: 0.125rem; }
.reservation-expires { font-size: 0.8125rem; color: var(--light); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .login-visual { display: none; }
    .login-form-side { width: 100%; min-width: 0; }
    .hero-title { font-size: 2rem; }
    .dessin-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .dessin-info { padding: 0.625rem 0.75rem; }
    .lightbox-inner { flex-direction: column; }
    .lightbox-sidebar { width: 100%; }
    .collections-panel { width: 100%; }
    .nav-inner { padding: 0 1rem; }
    .container { padding: 0 1rem; }
    .filter-bar { padding: 1rem 0; }
}

/* ---- CURATED COLLECTION CARDS ---- */
.curated-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}
.curated-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--white);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}
.curated-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -12px rgba(0,0,0,0.1);
}
.curated-cover {
    aspect-ratio: 16/9;
    object-fit: cover; width: 100%;
    background: var(--bg-warm);
}
.curated-info { padding: 1.25rem; }
.curated-name { font-family: var(--heading); font-size: 1.125rem; font-weight: 500; }
.curated-count { font-size: 0.8125rem; color: var(--light); margin-top: 0.25rem; }

/* New collection input */
.new-collection-form {
    display: flex; gap: 0.5rem;
    margin-top: 1rem;
}
.new-collection-form input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font); font-size: 0.875rem;
    outline: none;
}
.new-collection-form input:focus { border-color: var(--black); }

/* ---- ADMIN ---- */
.admin-tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.admin-tab {
    padding: 0.75rem 1.5rem;
    font-size: 0.8125rem; font-weight: 500;
    color: var(--mid); cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    margin-bottom: -1px;
}
.admin-tab:hover { color: var(--black); }
.admin-tab.active { color: var(--black); border-bottom-color: var(--black); }
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem; padding: 1.5rem 0;
}
.admin-stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.admin-stat-value {
    font-family: var(--heading);
    font-size: 2rem; font-weight: 600;
    letter-spacing: -0.03em;
}
.admin-stat-label {
    font-size: 0.8125rem; color: var(--light);
    margin-top: 0.25rem;
}
