/* ============================================
   PaintMixer - Painterly Theme (Artist's Studio)
   Warm paper & canvas, charcoal ink, paint daubs
   Mobile-first
   ============================================ */

:root {
    --bg-primary: #f0e7d8;   /* warm linen — the desk/canvas */
    --bg-secondary: #e8dcc8; /* kraft paper — nav band, recessed trays */
    --bg-card: #fbf6ee;      /* fresh canvas — cards lift off the page */
    --bg-input: #fffdf9;     /* clean paper — input fields */
    --text-primary: #2b2620; /* charcoal ink */
    --text-secondary: #6b6157;/* muted brown-grey ink */
    --text-muted: #8c8173;   /* faded pencil */
    --accent: #c0563a;       /* terracotta / burnt sienna */
    --accent-hover: #a8462d; /* deeper terracotta */
    --accent-green: #5f7d4f; /* sap green */
    --border: #ddd0bb;       /* warm taupe */
    --shadow: rgba(90,68,42,0.18); /* warm canvas shadow */
}

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

body {
    font-family: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)' opacity='0.05'/%3E%3C/svg%3E");
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

    a:hover {
        color: var(--accent-hover);
    }

/* ============================================
   TOP NAV
   ============================================ */

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.2rem;
}

.brand-icon {
    font-size: 1.4rem;
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.nav-discord {
    margin-left: 0.5rem;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
    text-decoration: none;
}

    .nav-discord:hover {
        opacity: 1;
    }

/* Hamburger button — hidden on desktop */
.nav-hamburger {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.3rem;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

    .nav-hamburger:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

    .nav-link:hover {
        background: var(--bg-card);
        color: var(--text-primary);
    }

.nav-cta {
    background: var(--accent);
    color: #fff !important;
    font-weight: 600;
}

    .nav-cta:hover {
        background: var(--accent-hover);
    }

.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-auth-mobile {
    display: none;
}

.nav-user {
    color: var(--accent-green);
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

    .btn-logout:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 0.75rem;
}

    .page-header h1 {
        font-size: 2rem;
        min-width: 0;
    }

    .page-header .btn-primary {
        width: auto;
        flex-shrink: 0;
        white-space: nowrap;
    }

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   FILTERS BAR
   ============================================ */

.filters-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-input, .brand-select, .type-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.search-input {
    flex: 1;
    min-width: 0;
}

    .search-input:focus, .brand-select:focus, .type-select:focus {
        outline: none;
        border-color: var(--accent);
    }

/* ============================================
   PAINT GRID
   ============================================ */

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

.paint-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem;
    transition: border-color 0.2s;
    min-width: 0;
}

    .paint-card:hover {
        border-color: var(--accent);
    }

.paint-swatch {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.16);
}

.paint-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.paint-name {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.paint-brand {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.paint-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ============================================
   MIX GRID
   ============================================ */

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

.mix-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    transition: border-color 0.2s;
    min-width: 0;
}

    .mix-card:hover {
        border-color: var(--accent);
        color: var(--text-primary);
    }

.mix-swatch {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.16);
}

.mix-info {
    flex: 1;
    min-width: 0;
}

.mix-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.mix-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mix-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    flex-wrap: wrap;
}

/* ============================================
   AUTH PAGES
   ============================================ */

.auth-page {
    display: flex;
    justify-content: center;
    padding-top: 3rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

    .auth-card h2 {
        margin-bottom: 1.5rem;
        text-align: center;
    }

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

    .form-group label {
        display: block;
        margin-bottom: 0.3rem;
        font-size: 0.85rem;
        color: var(--text-secondary);
    }

.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

    .form-input:focus {
        outline: none;
        border-color: var(--accent);
    }

.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

    .btn-primary:hover {
        background: var(--accent-hover);
        color: #fff;
    }

    .btn-primary:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.auth-card .btn-primary {
    width: 100%;
}

.error-msg {
    background: rgba(192,86,58,0.13);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-page {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
}

    .btn-page:hover:not(:disabled) {
        border-color: var(--accent);
    }

    .btn-page:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.page-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   UTILITIES
   ============================================ */

.loading {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.no-results {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

    .empty-state .btn-primary {
        width: auto;
        margin-top: 1rem;
    }

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.8rem;
}

/* ============================================
   MIX BUILDER
   ============================================ */

.mix-builder {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.mix-builder-main {
    min-width: 0;
}

.mix-builder-sidebar {
    position: sticky;
    top: 70px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-title {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    margin-bottom: 1rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

    .toggle-label input[type="checkbox"] {
        width: 18px;
        height: 18px;
        accent-color: var(--accent);
    }

.components-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.component-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    flex-wrap: wrap;
}

.component-swatch {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.16);
}

.component-info {
    flex: 1;
    min-width: 0;
}

.component-name {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.component-brand {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.component-parts {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.btn-parts {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-parts:hover:not(:disabled) {
        border-color: var(--accent);
        color: var(--accent);
    }

    .btn-parts:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.parts-value {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
}

.parts-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    border-radius: 4px;
}

    .btn-remove:hover {
        color: var(--accent);
        background: rgba(192,86,58,0.1);
    }

.ratio-display {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--accent-green);
    font-weight: 600;
}

.add-custom-section {
    margin-top: 1rem;
}

.custom-color-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.color-picker {
    width: 44px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    cursor: pointer;
    padding: 2px;
}

.form-input-sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    width: auto;
    flex: 1;
    min-width: 80px;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    width: auto;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-block;
    text-align: center;
}

    .btn-secondary:hover {
        border-color: var(--accent);
        color: var(--text-primary);
    }

.btn-danger {
    background: rgba(192,86,58,0.13);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

    .btn-danger:hover {
        background: rgba(192,86,58,0.22);
    }

.save-bar {
    display: flex;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* Preview card */
.preview-card, .paint-search-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

    .preview-card h3, .paint-search-card h3 {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
        color: var(--text-secondary);
    }

.preview-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.16);
    margin-bottom: 0.5rem;
}

.preview-hex {
    text-align: center;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Override color */
.override-color-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

/* Gloss control */
.gloss-control {
    margin-top: 1rem;
}

.gloss-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.gloss-value-label {
    color: var(--accent-green);
    font-weight: 600;
}

.gloss-slider {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
}

    .gloss-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: var(--accent);
        cursor: pointer;
    }

.gloss-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Paint search */
.search-results {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
}

    .search-result:hover {
        background: var(--bg-secondary);
    }

.paint-swatch-sm {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.16);
}

.search-result-info {
    min-width: 0;
}

.search-result-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.search-result-brand {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================
   MIX DETAIL VIEW
   ============================================ */

.mix-detail {
    max-width: 700px;
}

.mix-detail-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.mix-detail-preview {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.16);
}

.mix-detail-title h1 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.mix-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.mix-hex-badge {
    font-family: monospace;
    background: var(--bg-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.mix-detail-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.mix-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mix-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.recipe-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.recipe-row {
    display: grid;
    grid-template-columns: 44px 1fr auto 120px;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
}

.recipe-swatch {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.16);
}

.recipe-info {
    min-width: 0;
}

.recipe-paint-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.recipe-brand {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.recipe-ratio {
    text-align: right;
    font-size: 0.85rem;
    white-space: nowrap;
}

.recipe-pct {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.recipe-bar-container {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.recipe-bar {
    height: 100%;
    border-radius: 4px;
    min-width: 4px;
}

/* ============================================
   RECIPE GRID (My Recipes / Community)
   ============================================ */

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

.recipe-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    transition: border-color 0.2s;
    min-width: 0;
}

    .recipe-card:hover {
        border-color: var(--accent);
        color: var(--text-primary);
    }

.recipe-card-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.recipe-card-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.16);
}

.recipe-card-info {
    flex: 1;
    min-width: 0;
}

.recipe-card-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.recipe-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   RECIPE BUILDER
   ============================================ */

.recipe-builder {
    max-width: 800px;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.step-number {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent-green);
    background: rgba(95,125,79,0.12);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.step-header-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-icon:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

.btn-icon-danger:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.form-row-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.step-items {
    margin-top: 0.75rem;
}

.step-items-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    display: block;
}

.step-item-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

    .step-item-row:last-of-type {
        border-bottom: none;
    }

.step-item-info {
    flex: 1;
    min-width: 0;
}

.step-item-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.step-item-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
}

.step-item-notes {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.step-item-badge {
    font-size: 0.65rem;
    background: var(--accent);
    color: #fff;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.3rem;
    font-weight: 600;
}

.step-add-item {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.search-results-inline {
    max-height: 200px;
    margin-top: 0.25rem;
}

/* ============================================
   RECIPE VIEW
   ============================================ */

.recipe-detail {
    max-width: 700px;
}

.recipe-detail-header {
    margin-bottom: 1.5rem;
}

    .recipe-detail-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
    }

.recipe-steps-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step-view-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

.step-view-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.step-view-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-green);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-view-title-block {
    flex: 1;
    min-width: 0;
}

    .step-view-title-block h3 {
        font-size: 1rem;
        margin-bottom: 0.15rem;
    }

.step-technique-badge {
    display: inline-block;
    font-size: 0.7rem;
    background: rgba(95,125,79,0.15);
    color: var(--accent-green);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.step-view-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.step-view-items {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.step-view-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    flex-wrap: wrap;
}

.step-view-item-info {
    flex: 1;
    min-width: 0;
}

.step-view-item-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.step-view-item-brand {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
}

.step-view-link {
    font-size: 0.75rem;
    color: var(--accent);
    white-space: nowrap;
}

/* ============================================
   TAB BAR (Community page)
   ============================================ */

.tab-bar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

    .tab:hover {
        color: var(--text-primary);
    }

.tab-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ============================================
   RECIPE PHOTOS
   ============================================ */

.recipe-photo-preview {
    position: relative;
    display: inline-block;
    margin-bottom: 0.5rem;
}

    .recipe-photo-preview img {
        max-width: 300px;
        max-height: 200px;
        border-radius: 8px;
        border: 1px solid var(--border);
        display: block;
    }

.btn-remove-photo {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: rgba(0,0,0,0.7);
    color: var(--accent);
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

    .btn-remove-photo:hover {
        background: rgba(0,0,0,0.9);
    }

.recipe-photo-pending {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.recipe-detail-photo {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

    .recipe-detail-photo img {
        max-width: 100%;
        max-height: 300px;
        border-radius: 10px;
        border: 1px solid var(--border);
        display: block;
    }

/* ============================================
   COLLECTION GRID & CARDS
   ============================================ */

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

.collection-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    transition: border-color 0.2s;
    min-width: 0;
}

    .collection-card:hover {
        border-color: var(--accent);
        color: var(--text-primary);
    }

.collection-card-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.collection-card-info {
    flex: 1;
    min-width: 0;
}

.collection-card-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.collection-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collection-card-counts {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--accent-green);
    margin-top: 0.2rem;
}

/* ============================================
   COLLECTION DETAIL
   ============================================ */

.collection-detail-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

    .collection-detail-header .collection-card-icon {
        font-size: 3.5rem;
    }

.collection-summary-bar {
    display: flex;
    gap: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

    .collection-summary-bar span {
        font-size: 0.9rem;
        color: var(--accent-green);
    }

.collection-mixes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.collection-mix-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
}

.collection-mix-comp-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

/* ============================================
   COLLECTION EDITOR (ADD ITEMS)
   ============================================ */

.add-item-section {
    margin-top: 1rem;
}

.add-item-bar {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.search-results-dropdown {
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 0.25rem;
}

.search-result-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
}

    .search-result-row:hover {
        background: var(--bg-secondary);
    }

.success-msg {
    background: rgba(95,125,79,0.15);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

/* ============================================
   RESPONSIVE — MOBILE (<768px)
   ============================================ */

@media (max-width: 768px) {
    /* --- NAV: hamburger menu --- */
    .top-nav {
        flex-wrap: wrap;
        padding: 0.6rem 1rem;
    }

    .nav-hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        order: 3;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border);
        margin-top: 0.5rem;
        gap: 0;
    }

        .nav-links.nav-open {
            display: flex;
        }

        .nav-links .nav-link {
            padding: 0.65rem 0.5rem;
            border-radius: 6px;
            font-size: 0.95rem;
        }

            .nav-links .nav-link:hover {
                background: var(--bg-card);
            }

    .nav-auth-desktop {
        display: none;
    }

    .nav-auth-mobile {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.65rem 0.5rem;
        border-top: 1px solid var(--border);
        margin-top: 0.25rem;
    }

    .brand-sub {
        display: none;
    }

    /* --- MAIN CONTENT --- */
    .main-content {
        padding: 1rem 0.75rem;
    }

    .page-header {
        gap: 0.5rem;
    }

        .page-header h1 {
            font-size: 1.3rem;
        }

        .page-header .btn-primary {
            padding: 0.5rem 0.75rem;
            font-size: 0.8rem;
        }

    /* --- GRIDS: single column --- */
    .paint-grid,
    .mix-grid,
    .recipe-grid,
    .collection-grid {
        grid-template-columns: 1fr;
    }

    /* --- FILTERS --- */
    .filters-bar {
        flex-direction: column;
    }

    .search-input {
        min-width: 0;
    }

    /* --- MIX BUILDER --- */
    .mix-builder {
        grid-template-columns: 1fr;
    }

    .mix-builder-sidebar {
        position: static;
        order: -1;
    }

    .preview-swatch {
        aspect-ratio: 3/1;
    }

    .component-row {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .component-swatch {
        width: 32px;
        height: 32px;
    }

    /* --- MIX DETAIL --- */
    .mix-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .mix-detail-preview {
        width: 80px;
        height: 80px;
    }

    .mix-detail-title h1 {
        font-size: 1.3rem;
    }

    .mix-detail-meta {
        justify-content: center;
        gap: 0.5rem;
    }

    .mix-tags {
        justify-content: center;
    }

    /* Mix recipe rows: drop bar column */
    .recipe-row {
        grid-template-columns: 36px 1fr auto;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .recipe-swatch {
        width: 36px;
        height: 36px;
    }

    .recipe-bar-container {
        display: none;
    }

    /* --- RECIPE DETAIL --- */
    .recipe-detail-header {
        flex-direction: column;
    }

    .recipe-detail-photo img {
        max-height: 200px;
    }

    .recipe-detail-header h1 {
        font-size: 1.3rem;
    }

    /* --- RECIPE BUILDER --- */
    .form-row-pair {
        grid-template-columns: 1fr;
    }

    .step-add-item {
        flex-direction: column;
    }

    .step-card {
        padding: 0.75rem;
    }

    /* --- COLLECTION DETAIL --- */
    .collection-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .collection-summary-bar {
        justify-content: center;
        gap: 1rem;
    }

    .collection-mix-comp-row {
        font-size: 0.8rem;
    }

    /* --- TABS --- */
    .tab-bar {
        gap: 0;
    }

    .tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* --- MIX ACTIONS --- */
    .mix-actions {
        flex-wrap: wrap;
    }

    .btn-secondary,
    .btn-danger {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    /* --- AUTH --- */
    .auth-card {
        margin: 0 0.25rem;
        padding: 1.5rem;
    }

    .auth-page {
        padding-top: 1.5rem;
    }

    /* --- SAVE BAR --- */
    .save-bar {
        flex-direction: column;
    }

        .save-bar .btn-primary,
        .save-bar .btn-secondary,
        .save-bar .btn-danger {
            width: 100%;
        }

    /* --- CUSTOM COLOR FORM --- */
    .custom-color-form {
        flex-direction: column;
        align-items: stretch;
    }

    .color-picker {
        width: 100%;
        height: 44px;
    }

    .form-input-sm {
        min-width: 0;
        width: 100%;
    }

    /* --- ADD ITEM BAR --- */
    .add-item-bar {
        flex-direction: column;
    }
}

/* ============================================
   RESPONSIVE — SMALL MOBILE (<480px)
   ============================================ */

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.15rem;
    }

    .mix-swatch {
        width: 44px;
        height: 44px;
    }

    .mix-card {
        gap: 0.75rem;
        padding: 0.6rem;
    }

    .paint-swatch {
        width: 40px;
        height: 40px;
    }

    .recipe-card-thumb {
        width: 40px;
        height: 40px;
    }

    .recipe-card-icon {
        font-size: 1.6rem;
    }

    .collection-card-icon {
        font-size: 1.6rem;
    }

    .step-view-card {
        padding: 0.75rem;
    }

    .step-view-item {
        padding: 0.3rem;
    }
}

/* ============================================
   COLOR MATCH
   ============================================ */

.match-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.match-color {
    width: 56px;
    height: 44px;
    padding: 2px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.match-hex {
    flex: 0 1 160px;
    text-transform: uppercase;
}

.btn-match {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

    .btn-match:hover {
        background: var(--accent-hover);
    }

.match-preview {
    height: 64px;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.match-preview-tag {
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
}

.match-error {
    color: var(--accent);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.match-de {
    flex-shrink: 0;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    padding-left: 0.4rem;
}

.match-de-num {
    font-weight: 700;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.match-de-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.q-perfect .match-de-num { color: #2f7d4f; }
.q-excellent .match-de-num { color: #557d33; }
.q-close .match-de-num { color: #9c6b10; }
.q-fair .match-de-num { color: #bf6a2f; }
.q-distant .match-de-num { color: var(--text-muted); }

/* ---- Match from a paint you own (source picker) ---- */
.match-source {
    margin-bottom: 1.25rem;
}

.match-source-field {
    position: relative;
    max-width: 480px;
}

.match-search {
    width: 100%;
}

.match-suggestions {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-y: auto;
    max-height: 320px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.match-suggestion {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
}

    .match-suggestion:last-child { border-bottom: none; }
    .match-suggestion:hover { background: var(--bg-input); }

.match-suggestion-swatch {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.16);
}

.match-suggestion-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.match-suggestion-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-suggestion-brand {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.match-suggestion-hex {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.match-source-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.6rem;
    padding: 0.5rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 8px;
    max-width: 480px;
}

.match-source-swatch {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.16);
}

.match-source-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.match-source-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-source-brand {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.match-source-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    flex-shrink: 0;
}

    .match-source-clear:hover { color: var(--accent); background: var(--bg-input); }

/* ---- "Find similar" button on paint cards ---- */
.btn-similar {
    flex-shrink: 0;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

    .btn-similar:hover {
        color: #fff;
        background: var(--accent);
        border-color: var(--accent);
    }

/* ============================================
   PAINTERLY THEME LAYER
   Artist's-studio finish: display type, paper,
   paint-daub swatches, brushstroke accents.
   (Appended last so these treatments win.)
   ============================================ */

/* Expressive display serif for titles & brand */
h1, h2, h3,
.section-title,
.nav-brand a {
    font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
    font-optical-sizing: auto;
    letter-spacing: -0.01em;
}

.page-header h1 {
    position: relative;
    font-weight: 900;
    line-height: 1.15;
}

/* A hand-laid brushstroke beneath the page title */
.page-header h1::after {
    content: "";
    position: absolute;
    left: 1px;
    right: -8px;
    bottom: -7px;
    height: 7px;
    background: var(--accent);
    opacity: 0.85;
    border-radius: 60% 40% 58% 42% / 100% 100% 0% 0%;
    transform: rotate(-0.7deg);
}

/* "by ZAP Games" as a studio annotation */
.brand-sub {
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    color: var(--accent);
    opacity: 0.9;
}

.subtitle {
    font-style: italic;
}

/* Cards as paper laid on the canvas — a soft warm lift */
.paint-card,
.mix-card,
.recipe-card,
.collection-card,
.preview-card,
.paint-search-card,
.auth-card,
.step-card,
.step-view-card {
    box-shadow: 0 2px 6px var(--shadow);
}

/* Swatches as daubs of real paint: organic edge + tactile light */
.paint-swatch,
.mix-swatch,
.preview-swatch,
.component-swatch {
    border-radius: 47% 53% 50% 50% / 58% 56% 44% 42%;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.35),
                inset 0 -3px 7px rgba(0,0,0,0.16),
                0 2px 5px var(--shadow);
    transition: border-radius 0.25s ease;
}

.paint-card:hover .paint-swatch,
.mix-card:hover .mix-swatch {
    border-radius: 53% 47% 56% 44% / 52% 60% 40% 48%;
}

/* Members-only invitation panel — shown to logged-out visitors on
   My Mixes / My Recipes / My Collections. A framed studio card. */
.gate {
    max-width: 460px;
    margin: 2rem auto;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.5rem 2rem;
    box-shadow: 0 2px 6px var(--shadow);
}

.gate-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.gate-title {
    font-size: 1.6rem;
    margin-bottom: 0.35rem;
}

.gate-tag {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.gate-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.gate-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.gate-actions .btn-primary {
    width: auto;
}

.gate-login {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.gate-login:hover {
    color: var(--accent);
}
