/* Artist Portal — Products (v2)
 * Reads Flatsome's own CSS custom properties (--primary-color etc.) with
 * sane fallbacks, so the portal matches the active theme's colour scheme
 * without any extra config. Falls back gracefully on non-Flatsome themes.
 */

.ap-portal {
    --ap-accent: var(--primary-color, #4f46e5);
    --ap-accent-purple: #7c3aed;
    --ap-border: #e2e8f0;
    --ap-text: #334155;
    --ap-muted: #64748b;
    max-width: 860px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--ap-border);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.ap-portal[data-accent="purple"] { --ap-accent: var(--ap-accent-purple); }

.ap-title { font-size: 1.75rem; font-weight: 700; margin: 0 0 .25rem; color: var(--ap-text); }
.ap-subtitle { color: var(--ap-muted); margin: 0 0 2rem; }

.ap-progress { position: relative; display: flex; justify-content: space-between; margin-bottom: 2rem; }
.ap-progress__track, .ap-progress__fill { position: absolute; top: 50%; left: 0; height: 3px; transform: translateY(-50%); z-index: 0; }
.ap-progress__track { width: 100%; background: #eef0f4; }
.ap-progress__fill { background: var(--ap-accent); transition: width .3s ease; }
.ap-step-indicator { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; background: #fff; padding: 0 .4rem; }
.ap-step-indicator__circle { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--ap-border); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #94a3b8; background: #fff; margin-bottom: .4rem; transition: all .2s ease; }
.ap-step-indicator__label { font-size: .72rem; font-weight: 600; color: var(--ap-muted); }
.ap-step-indicator.is-active .ap-step-indicator__circle { border-color: var(--ap-accent); color: var(--ap-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ap-accent) 15%, transparent); }
.ap-step-indicator.is-active .ap-step-indicator__label { color: var(--ap-accent); }
.ap-step-indicator.is-done .ap-step-indicator__circle { border-color: #10b981; background: #10b981; color: #fff; }
.ap-step-indicator.is-done .ap-step-indicator__label { color: #059669; }

.ap-feedback { display: none; padding: .9rem 1.1rem; border-radius: 10px; font-weight: 600; margin-bottom: 1.25rem; }
.ap-feedback:not(:empty) { display: block; }
.ap-feedback--success { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.ap-feedback--error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

.ap-form-step[hidden] { display: none; }
.ap-field { margin-bottom: 1.1rem; }
.ap-field label { display: block; font-weight: 700; color: var(--ap-text); margin-bottom: .35rem; font-size: .92rem; }
.ap-field input, .ap-field select {
    width: 100%; box-sizing: border-box; height: 46px; padding: 0 .85rem;
    border: 1px solid var(--ap-border) !important; border-radius: 8px !important; font-size: .95rem;
}
.ap-field textarea {
    width: 100%; box-sizing: border-box; padding: .7rem .85rem;
    border: 1px solid var(--ap-border) !important; border-radius: 8px !important; font-size: .95rem;
}
.ap-field select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'><path d='M5.5 7.5l4.5 5 4.5-5z'/></svg>");
    background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px;
    padding-right: 2.2rem;
}
.ap-field input:focus, .ap-field select:focus, .ap-field textarea:focus {
    outline: none; border-color: var(--ap-accent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ap-accent) 15%, transparent);
}
.ap-invalid { border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.15) !important; }

.ap-grid { display: grid; gap: 1rem; }
.ap-grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .ap-grid--4 { grid-template-columns: repeat(2, 1fr); } }
.ap-grid--2 { grid-template-columns: repeat(2, 1fr); margin-bottom: 1.1rem; }
@media (max-width: 640px) { .ap-grid--2 { grid-template-columns: 1fr; } }
.ap-grid--2 .ap-field { margin-bottom: 0; }

.ap-input-group { display: flex; align-items: stretch; border: 1px solid var(--ap-border); border-radius: 8px; overflow: hidden; }
.ap-input-group__prefix { display: flex; align-items: center; padding: 0 .75rem; background: #f1f5f9; color: var(--ap-muted); font-size: .88rem; white-space: nowrap; }
.ap-input-group input { border: none !important; border-radius: 0 !important; box-shadow: none !important; }
.ap-input-group:focus-within { border-color: var(--ap-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ap-accent) 15%, transparent); }

.ap-dropzone { border: 2px dashed var(--ap-border); border-radius: 12px; padding: 1.5rem; text-align: center; background: #f8fafc; margin-bottom: 1.25rem; transition: border-color .2s; }
.ap-dropzone.is-dragover { border-color: var(--ap-accent); background: color-mix(in srgb, var(--ap-accent) 6%, #f8fafc); }
.ap-dropzone__label { display: block; font-weight: 700; margin-bottom: .5rem; }
.ap-dropzone__hint { color: var(--ap-muted); font-size: .82rem; margin: .5rem 0 0; }
.ap-preview-grid { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: 1.25rem; }
.ap-thumb { position: relative; width: 90px; height: 90px; border-radius: 10px; overflow: hidden; border: 1px solid var(--ap-border); background: #fff; }
.ap-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-thumb__remove { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; line-height: 1; cursor: pointer; }
.ap-thumb--uploading { display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.ap-thumb__bar { width: 100%; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.ap-thumb__bar-fill { height: 100%; width: 0; background: var(--ap-accent); transition: width .15s; }

.ap-tag-group { margin-bottom: 1.25rem; }
.ap-tag-group h4 { font-weight: 700; border-bottom: 1px solid var(--ap-border); padding-bottom: .4rem; margin-bottom: .6rem; }
.ap-checkbox-list { display: flex; flex-direction: column; gap: .45rem; }
.ap-checkbox-list label { display: flex; align-items: center; gap: .5rem; color: var(--ap-text); font-size: .93rem; }

.ap-panel { background: #f8fafc; border: 1px solid var(--ap-border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1.25rem; }
.ap-attr-row { background: #fff; border: 1px solid var(--ap-border); border-radius: 10px; padding: 1rem; margin-bottom: .85rem; }
.ap-attr-row__head { display: flex; gap: .75rem; align-items: center; margin-bottom: .6rem; }
.ap-attr-row__head select { flex: 1; padding: .6rem; border-radius: 8px; border: 1px solid var(--ap-border); }
.ap-attr-row__remove { border: none; background: none; font-size: 1.2rem; color: #94a3b8; cursor: pointer; }
.ap-center { text-align: center; margin-bottom: 1.25rem; }

.ap-variations-table table { width: 100%; border-collapse: collapse; }
.ap-variations-table th, .ap-variations-table td { padding: .6rem; text-align: left; border-bottom: 1px solid var(--ap-border); font-size: .88rem; }
.ap-variations-table thead th { background: #f1f5f9; text-transform: uppercase; font-size: .72rem; letter-spacing: .03em; }
.ap-variations-table input { width: 100%; padding: .45rem; border: 1px solid var(--ap-border); border-radius: 6px; }

.ap-summary { background: color-mix(in srgb, var(--ap-accent) 6%, #fff); border: 1px solid color-mix(in srgb, var(--ap-accent) 25%, #fff); border-radius: 12px; padding: 1.25rem; }
.ap-summary ul { margin: 0; padding-left: 1.1rem; color: var(--ap-text); }
.ap-summary li { margin-bottom: .4rem; }

.ap-nav { display: flex; align-items: center; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #f1f5f9; }
.ap-nav__spacer { flex: 1; }
.ap-nav .button { border-radius: 8px; }
.ap-nav .ap-btn-next, .ap-nav .ap-btn-submit { background-color: var(--ap-accent); border-color: var(--ap-accent); }

.ap-notice { padding: 1rem 1.25rem; border-radius: 10px; }
.ap-notice--warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.ap-muted { color: var(--ap-muted); font-size: .88rem; }

/* ---------- Dashboard ---------- */
.ap-dashboard {
    --ap-accent: var(--primary-color, #4f46e5);
    max-width: 1080px; margin: 0 auto; background: #fff; border: 1px solid #e2e8f0;
    border-radius: 14px; padding: 2rem;
}
.ap-dashboard__header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.ap-dashboard__actions { display: flex; gap: .6rem; }
.ap-dashboard__actions .button { background-color: var(--ap-accent); border-color: var(--ap-accent); }
.ap-dashboard__filters { display: flex; gap: .75rem; margin-bottom: 1.25rem; }
.ap-dashboard__filters select { padding: .55rem .75rem; border: 1px solid #e2e8f0; border-radius: 8px; }

.ap-dashboard__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.ap-products-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .ap-products-grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .ap-products-grid-3 { grid-template-columns: 1fr; } }
.ap-product-card { border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; background: #fff; cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
.ap-product-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,.08); transform: translateY(-2px); }
.ap-product-card:focus { outline: 2px solid var(--ap-accent); outline-offset: 2px; }

.ap-product-card__media { position: relative; }
.ap-product-card__media img { width: 100%; height: 150px; object-fit: cover; display: block; background: #f1f5f9; }
.ap-product-card__hover {
    position: absolute; inset: 0; background: rgba(15, 23, 42, .38);
    display: flex; align-items: center; justify-content: center; gap: .65rem;
    opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.ap-product-card:hover .ap-product-card__hover,
.ap-product-card:focus-within .ap-product-card__hover { opacity: 1; pointer-events: auto; }

.ap-icon-btn {
    width: 38px; height: 38px; border-radius: 50%; border: none; background: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.2); color: var(--ap-text, #334155); transition: background .15s, color .15s;
}
.ap-icon-btn svg { width: 17px; height: 17px; }
.ap-icon-btn--edit:hover { background: var(--ap-accent); color: #fff; }
.ap-icon-btn--delete:hover { background: #ef4444; color: #fff; }

.ap-product-card__body { padding: .9rem 1rem 1rem; }
.ap-product-card__body h4 { margin: 0 0 .4rem; font-size: .98rem; }
.ap-product-card__meta { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.ap-product-card__price { font-weight: 700; color: var(--ap-text, #334155); }

.ap-badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.ap-badge--publish { background: #d1fae5; color: #047857; }
.ap-badge--pending { background: #fef3c7; color: #92400e; }
.ap-badge--draft { background: #e2e8f0; color: #475569; }

.ap-dashboard__pagination { margin-top: 1.5rem; }

/* ---------- Main profile/analytics dashboard ([artist_dashboard]) ---------- */
.ap-md {
    --ap-accent: var(--primary-color, #4f46e5);
    max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.75rem;
}

.ap-md-banner {
    display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
    padding: 2.25rem; border-radius: 20px; color: #fff;
    background: linear-gradient(120deg, #0f172a, var(--ap-accent) 140%);
}
.ap-md-avatar { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255,255,255,.25); box-shadow: 0 0 0 4px rgba(255,255,255,.08); }
.ap-md-badge { display: inline-block; padding: .25rem .7rem; border-radius: 999px; font-size: .72rem; font-weight: 700; background: rgba(255,255,255,.12); color: #c7d2fe; margin-bottom: .5rem; }
.ap-md-banner__info h1 { margin: 0 0 .3rem; font-size: 1.9rem; font-weight: 800; color: #fff; }
.ap-md-banner__info p { margin: 0; color: rgba(255,255,255,.7); font-size: .9rem; }
.ap-md-instagram { display: inline-block; margin: 0 0 .35rem; color: #c7d2fe; font-size: .88rem; font-weight: 600; text-decoration: none; }
.ap-md-instagram:hover { text-decoration: underline; }
.ap-md-banner__edit { margin-left: auto; align-self: center; background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.3); color: #fff !important; }
.ap-md-banner__edit:hover { background: rgba(255,255,255,.25); }

.ap-md-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.ap-md-stat { display: flex; align-items: center; gap: 1rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 1.4rem; }
.ap-md-stat__icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: 12px; background: #ede9fe; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.ap-md-stat--sales .ap-md-stat__icon { background: #d1fae5; }
.ap-md-stat p { margin: 0; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #64748b; }
.ap-md-stat h3 { margin: .2rem 0 0; font-size: 1.6rem; font-weight: 800; color: #0f172a; }
.ap-md-stat--sales h3 { color: #059669; }

.ap-md-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 1.6rem; }
.ap-md-card h2 { margin: 0; font-size: 1.2rem; font-weight: 700; }
.ap-md-chart { height: 280px; margin-top: 1rem; }

.ap-md-section h2 { font-size: 1.35rem; font-weight: 700; margin: 0 0 1rem; display: flex; align-items: center; gap: .4rem; }
.ap-md-empty { background: #fff; border: 1px dashed #cbd5e1; border-radius: 16px; padding: 2.5rem; text-align: center; color: #64748b; }

.ap-md-cta { display: flex; gap: 1rem; flex-wrap: wrap; padding-top: .5rem; border-top: 1px solid #f1f5f9; }
.ap-md-cta__btn { flex: 1; min-width: 200px; text-align: center; padding: 1.1rem 1.5rem; border-radius: 16px; font-weight: 700; color: #fff !important; border: none; }
.ap-md-cta__btn--artwork { background-color: var(--ap-accent); border-color: var(--ap-accent); }
.ap-md-cta__btn--merch { background-color: #7c3aed; border-color: #7c3aed; }

/* ---------- Public artist directory ([artist_directory]) ---------- */
.ap-directory {
    --ap-accent: var(--primary-color, #4f46e5);
    max-width: 1080px; margin: 0 auto;
}
.ap-directory__header { text-align: center; margin-bottom: 1.5rem; }
.ap-directory__pills { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-bottom: 1.75rem; }
.ap-pill {
    padding: .5rem 1.15rem; border-radius: 999px; border: 1px solid #e2e8f0; background: #fff;
    color: #475569; font-size: .85rem; font-weight: 600; cursor: pointer; transition: all .15s ease;
}
.ap-pill:hover { border-color: var(--ap-accent); color: var(--ap-accent); }
.ap-pill.is-active { background: var(--ap-accent); border-color: var(--ap-accent); color: #fff; }
.ap-directory__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }

.ap-artist-card { border: 1px solid #e2e8f0; border-radius: 16px; padding: 1.5rem; background: #fff; text-align: center; transition: box-shadow .15s ease, transform .15s ease; }
.ap-artist-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.07); transform: translateY(-2px); }
.ap-artist-card__avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto .8rem; display: block; border: 3px solid #f1f5f9; }
.ap-artist-card h4 { margin: 0 0 .2rem; font-size: 1.05rem; }
.ap-artist-card__instagram { display: block; font-size: .8rem; color: var(--ap-accent); text-decoration: none; margin-bottom: .2rem; }
.ap-artist-card__province { font-size: .8rem; color: #64748b; margin-bottom: .9rem; }
.ap-artist-card__products { display: flex; gap: .4rem; justify-content: center; margin-bottom: 1rem; }
.ap-artist-card__products img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid #f1f5f9; }
.ap-artist-card__count { display: block; font-size: .72rem; color: #94a3b8; margin-bottom: .9rem; }
.ap-artist-card .button { width: 100%; }

/* ---------- Public "about the artist" story ([artist_profile_public]) ---------- */
.ap-artist-story { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-top: 1rem; }
.ap-artist-story__item h4 { margin: 0 0 .35rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ap-accent); }
.ap-artist-story__item p { margin: 0; color: #334155; font-size: .92rem; line-height: 1.55; white-space: pre-line; }

/* ---------- Curator's Note & Artist Story ([artist_curator_note]) ---------- */
.ap-curator-note { max-width: 900px; margin: 3rem auto; }
.ap-curator-note__quote {
    margin: 0 0 1.25rem; padding: .1rem 0 .1rem 1.25rem;
    border-left: 3px solid var(--primary-color, #4f46e5);
    font-style: italic; color: #475569; font-size: 1.05rem; line-height: 1.65;
}
.ap-curator-note__body { margin: 0; color: #334155; font-size: .98rem; line-height: 1.75; white-space: pre-line; }
.ap-curator-note__by { margin: 1rem 0 0; text-align: right; font-size: .85rem; color: #64748b; }
.ap-curator-note__by a { color: var(--primary-color, #4f46e5); text-decoration: none; font-weight: 600; }
.ap-curator-note__by a:hover { text-decoration: underline; }
