/*
Theme Name: Sewing Pattern Support
Theme URI: https://example.com/sewing-pattern-support
Author: MultiMall
Author URI: https://example.com
Description: An AI-powered support theme for Etsy sewing-pattern sellers. Premium Etsy-inspired design with a marketing home page and an admin dashboard to add pattern products (Etsy link + guide PDF), draft customer answers with OpenAI (reads the guide PDF + customer photos), chat with an AI sewing expert, and dictate messages by voice.
Version: 1.3.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sps
*/

/* =========================================================================
   Design tokens — Etsy-inspired premium
   ========================================================================= */
:root {
  --orange: #f1641e;
  --orange-dark: #d9530f;
  --orange-soft: #fdeee5;
  --ink: #222021;
  --ink-soft: #3f3b3a;
  --muted: #595959;
  --muted-2: #8a847f;
  --line: #e7e3dd;
  --line-2: #f0ece6;
  --bg: #ffffff;
  --warm: #faf7f3;
  --warm-2: #f4efe8;
  --black: #222021;
  --green: #2f8f5b;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(34, 32, 33, .04), 0 4px 14px rgba(34, 32, 33, .05);
  --sh-2: 0 14px 40px rgba(34, 32, 33, .11);
  --sh-orange: 0 10px 26px rgba(241, 100, 30, .28);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

/* Icons */
.sps-svg { display: inline-block; vertical-align: middle; flex: none; }
.sps-btn .sps-svg { margin-top: -1px; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
}

a { color: var(--orange-dark); text-decoration: none; }
a:hover { color: var(--orange); }

.sps-container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

::selection { background: var(--orange-soft); }

/* =========================================================================
   Buttons — Etsy black pill primary, orange + outline variants
   ========================================================================= */
.sps-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  background: var(--black); color: #fff; border: 1.5px solid var(--black);
  padding: 13px 26px; border-radius: var(--r-pill);
  font-family: var(--sans); font-weight: 700; font-size: 15px; line-height: 1;
  text-decoration: none; letter-spacing: .1px;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.sps-btn:hover { background: #000; color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(0,0,0,.18); }
.sps-btn:active { transform: translateY(0); }

.sps-btn.orange { background: var(--orange); border-color: var(--orange); }
.sps-btn.orange:hover { background: var(--orange-dark); border-color: var(--orange-dark); box-shadow: var(--sh-orange); }

.sps-btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.sps-btn.secondary:hover { background: var(--warm); color: var(--ink); border-color: var(--muted-2); box-shadow: var(--sh-1); }

.sps-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.sps-btn.block { width: 100%; }

/* =========================================================================
   Site header
   ========================================================================= */
.sps-site-header {
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 60;
}
.sps-site-header .sps-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0;
}
.sps-logo {
  font-family: var(--sans); font-weight: 900; font-size: 22px;
  letter-spacing: -.5px; color: var(--ink); display: inline-flex; align-items: center; gap: 9px;
}
.sps-logo .dot {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--orange), #ff9a5a);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; box-shadow: var(--sh-orange);
}
.sps-logo span { color: var(--orange); }
.sps-nav { display: flex; align-items: center; gap: 6px; }
.sps-nav a { padding: 9px 14px; border-radius: var(--r-pill); color: var(--ink-soft); font-weight: 600; font-size: 15px; }
.sps-nav a:hover { background: var(--warm-2); color: var(--ink); }
.sps-nav a.cta { background: var(--ink); color: #fff; }
.sps-nav a.cta:hover { background: #000; color: #fff; }

/* =========================================================================
   Hero
   ========================================================================= */
.sps-hero { position: relative; overflow: hidden; padding: 92px 0 70px; }
.sps-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(1100px 480px at 88% -8%, var(--orange-soft), transparent 60%),
    radial-gradient(700px 380px at -5% 110%, var(--warm-2), transparent 60%);
}
.sps-hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }

.sps-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); color: var(--orange-dark);
  font-weight: 700; font-size: 13px; letter-spacing: .3px; text-transform: uppercase;
  padding: 7px 14px; border-radius: var(--r-pill); box-shadow: var(--sh-1); margin-bottom: 22px;
}
.sps-eyebrow .dot-i { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }

.sps-hero h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(38px, 5vw, 58px); line-height: 1.04; letter-spacing: -.5px;
  margin: 0 0 20px; color: var(--ink);
}
.sps-hero h1 em { font-style: italic; color: var(--orange); }
.sps-hero p.lead { font-size: 19px; color: var(--muted); max-width: 540px; margin: 0 0 30px; }
.sps-cta-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.sps-trust { margin-top: 22px; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sps-trust .ck { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: #e9f6ef; color: var(--green); align-items: center; justify-content: center; }

/* Preview card (right side of hero) */
.sps-preview {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-2); padding: 20px; transform: rotate(.6deg);
}
.sps-preview .pv-head { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); margin-bottom: 16px; }
.sps-preview .pv-thumb { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg,#ff9a5a,#f1641e); display:flex; align-items:center; justify-content:center; color:#fff; }
.sps-preview .pv-title { font-weight: 800; font-size: 15px; }
.sps-preview .pv-sub { font-size: 12.5px; color: var(--muted-2); }
.pv-bubble { border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.pv-bubble.q { background: var(--warm-2); color: var(--ink-soft); }
.pv-bubble.a { background: var(--orange-soft); border: 1px solid #f6d7c2; color: var(--ink); }
.pv-bubble .who { font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--muted-2); display:block; margin-bottom: 4px; }
.pv-bubble.a .who { color: var(--orange-dark); }
.pv-foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--green); font-weight: 700; }

/* =========================================================================
   Feature cards
   ========================================================================= */
.sps-section-head { text-align: center; max-width: 620px; margin: 0 auto 36px; }
.sps-section-head h2 { font-family: var(--display); font-weight: 600; font-size: 34px; letter-spacing: -.4px; margin: 0 0 10px; }
.sps-section-head p { color: var(--muted); font-size: 17px; margin: 0; }

.sps-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding: 30px 0 96px; }
.sps-feature {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 28px; box-shadow: var(--sh-1);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.sps-feature:hover { transform: translateY(-4px); box-shadow: var(--sh-2); border-color: #efd9cb; }
.sps-feature .ic {
  width: 54px; height: 54px; border-radius: 15px; background: var(--orange-soft);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
  color: var(--orange-dark);
}
.sps-feature .ic .sps-svg { width: 27px; height: 27px; }
.sps-feature .step { font-size: 12px; font-weight: 800; letter-spacing: .5px; color: var(--orange); text-transform: uppercase; }
.sps-feature h3 { margin: 4px 0 8px; font-size: 19px; font-weight: 800; }
.sps-feature p { margin: 0; color: var(--muted); font-size: 15px; }

/* =========================================================================
   Footer
   ========================================================================= */
.sps-site-footer { border-top: 1px solid var(--line); background: var(--warm); padding: 36px 0; color: var(--muted); font-size: 14.5px; }
.sps-site-footer .sps-container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* =========================================================================
   Dashboard
   ========================================================================= */
.sps-dash { padding: 46px 0 90px; background:
  radial-gradient(900px 340px at 92% -10%, var(--orange-soft), transparent 60%); }
.sps-dash .head-row { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.sps-dash h1 { font-family: var(--display); font-weight: 600; margin: 0 0 4px; font-size: 36px; letter-spacing: -.5px; }
.sps-dash .sps-sub { color: var(--muted); margin: 0; font-size: 16px; }

/* Segmented tab bar */
.sps-tabs {
  display: inline-flex; gap: 4px; background: var(--warm-2);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 5px; margin-bottom: 30px; flex-wrap: wrap;
}
.sps-tab {
  background: transparent; border: 0; padding: 10px 18px; cursor: pointer;
  font-family: var(--sans); font-weight: 700; font-size: 14.5px; color: var(--muted);
  border-radius: var(--r-pill); transition: all .14s ease;
  display: inline-flex; align-items: center; gap: 7px;
}
.sps-tab .sps-svg { width: 17px; height: 17px; opacity: .85; }
.sps-tab.active .sps-svg { color: var(--orange); opacity: 1; }
.sps-tab:hover { color: var(--ink); }
.sps-tab.active { background: #fff; color: var(--ink); box-shadow: var(--sh-1); }

.sps-panel { display: none; animation: sps-fade .25s ease; }
.sps-panel.active { display: block; }
@keyframes sps-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.sps-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 32px; box-shadow: var(--sh-1);
  max-width: 780px;
}
.sps-card h2 { font-family: var(--display); font-weight: 600; margin: 0 0 6px; font-size: 24px; letter-spacing: -.3px; }
.sps-card .hint { color: var(--muted); font-size: 15px; margin: 0 0 26px; }

/* Forms */
.sps-field { margin-bottom: 20px; }
.sps-field label { display: block; font-weight: 700; margin-bottom: 7px; font-size: 14px; color: var(--ink); }
.sps-field .sub { font-weight: 500; color: var(--muted-2); font-size: 13px; }
.sps-field input[type=text],
.sps-field input[type=url],
.sps-field input[type=password],
.sps-field input[type=email],
.sps-field select,
.sps-field textarea {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--line);
  border-radius: var(--r-sm); font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .14s ease, box-shadow .14s ease;
}
.sps-field input:focus,
.sps-field select:focus,
.sps-field textarea:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft);
}
.sps-field textarea { min-height: 120px; resize: vertical; }

/* File upload — styled dropzone look */
.sps-file {
  position: relative; border: 1.5px dashed var(--line); border-radius: var(--r-sm);
  padding: 16px; background: var(--warm); transition: border-color .14s ease, background .14s ease;
}
.sps-file:hover { border-color: var(--orange); background: var(--orange-soft); }
.sps-file input[type=file] { width: 100%; font-size: 14px; color: var(--muted); }
.sps-file.req { border-color: #f0c9b2; }

/* Notices */
.sps-notice { padding: 14px 18px; border-radius: var(--r-sm); margin-bottom: 22px; font-size: 14.5px; display: flex; gap: 10px; align-items: flex-start; }
.sps-notice .ni { font-size: 16px; line-height: 1.5; }
.sps-notice.ok { background: #e9f6ef; color: #1c6b41; border: 1px solid #bce3cd; }
.sps-notice.err { background: #fcebeb; color: #9b2c2c; border: 1px solid #f1c6c6; }
.sps-notice.warn { background: #fff6e8; color: #8a5a12; border: 1px solid #f5dba8; }

/* Answer box */
#sps-answer-wrap { margin-top: 26px; display: none; }
#sps-answer-wrap > label { font-weight: 800; font-size: 13px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted-2); display: block; margin-bottom: 8px; }
#sps-answer {
  background: var(--warm); border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: var(--r-sm); padding: 20px; white-space: pre-wrap; font-size: 15px; line-height: 1.7;
}
.sps-answer-tools { display: flex; gap: 10px; margin-top: 14px; }
.sps-spinner {
  display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff; border-radius: 50%; animation: sps-spin .7s linear infinite; vertical-align: middle;
}
@keyframes sps-spin { to { transform: rotate(360deg); } }

/* Product list */
.sps-list { max-width: 780px; }
.sps-list .lh { font-size: 13px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .6px; font-weight: 800; margin: 0 0 14px; }
.sps-product {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--sh-1);
  transition: transform .14s ease, box-shadow .14s ease;
}
.sps-product-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.sps-product:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.sps-product .pt { display: flex; align-items: center; gap: 14px; }
.sps-product .pthumb { width: 42px; height: 42px; border-radius: 11px; background: var(--orange-soft); color: var(--orange-dark); display: flex; align-items: center; justify-content: center; }
.sps-product strong { font-size: 15.5px; }
.sps-product .meta { font-size: 13px; color: var(--muted); }
.sps-product .meta a { display: inline-flex; align-items: center; gap: 4px; }
.sps-badge { font-size: 12px; font-weight: 800; padding: 5px 12px; border-radius: var(--r-pill); background: var(--warm-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.sps-badge.live { background: #e9f6ef; color: #1c6b41; border-color: #bce3cd; }

/* Product row actions */
.sps-product-actions { display: flex; align-items: center; gap: 8px; }
.sps-inline-form { margin: 0; display: inline; }
.sps-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  background: #fff; color: var(--muted); border: 1px solid var(--line);
  transition: all .14s ease;
}
.sps-iconbtn:hover { background: var(--warm); color: var(--ink); border-color: var(--muted-2); }
.sps-iconbtn.danger:hover { background: #fcebeb; color: #c0392b; border-color: #f1c6c6; }
.sps-iconbtn .sps-svg { width: 18px; height: 18px; }

/* ---- Searchable combobox ---- */
.sps-combo { position: relative; }
.sps-combo-ic {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); pointer-events: none; display: inline-flex;
}
.sps-combo > input[type=text] {
  width: 100%; padding: 13px 15px 13px 44px; border: 1.5px solid var(--line);
  border-radius: var(--r-sm); font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .14s ease, box-shadow .14s ease;
}
.sps-combo > input[type=text]:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.sps-combo.chosen > input[type=text] { border-color: var(--orange); }
.sps-combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-2); padding: 6px; max-height: 280px; overflow-y: auto;
  display: none;
}
.sps-combo.open .sps-combo-list { display: block; }
.sps-combo-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px;
  cursor: pointer; font-size: 15px; color: var(--ink);
}
.sps-combo-item .sps-svg { color: var(--orange); width: 18px; height: 18px; flex: none; }
.sps-combo-item:hover { background: var(--orange-soft); }
.sps-combo-empty { padding: 14px 12px; color: var(--muted-2); font-size: 14px; }

/* Login */
.sps-login { max-width: 440px; margin: 70px auto; }
.sps-login .sps-card { padding: 36px; }
.sps-login h1 { font-family: var(--display); font-weight: 600; font-size: 27px; margin: 0 0 6px; letter-spacing: -.3px; }
.sps-login .lsub { color: var(--muted); margin: 0 0 22px; font-size: 15px; }
.sps-login .login-username,
.sps-login .login-password { margin-bottom: 16px; }
.sps-login label { display:block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.sps-login input[type=text],
.sps-login input[type=password] {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--line);
  border-radius: var(--r-sm); font-size: 15px; font-family: inherit;
}
.sps-login input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.sps-login .login-remember { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.sps-login .login-submit input {
  width: 100%; cursor: pointer; background: var(--black); color: #fff; border: 0;
  padding: 14px; border-radius: var(--r-pill); font-weight: 700; font-size: 15px;
}
.sps-login .login-submit input:hover { background: #000; }

/* =========================================================================
   Responsive
   ========================================================================= */
/* ---- Image previews (ask) + product gallery ---- */
.sps-img-previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.sps-img-prev { width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--sh-1); }
.sps-img-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sps-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.sps-gallery-item { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); display: block; transition: transform .14s ease; }
.sps-gallery-item:hover { transform: scale(1.05); }
.sps-gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Textarea + mic ---- */
.sps-textwrap { position: relative; }
.sps-textwrap textarea { padding-right: 52px; }
.sps-mic {
  position: absolute; right: 10px; bottom: 10px;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--muted); border: 1.5px solid var(--line);
  transition: all .14s ease;
}
.sps-mic:hover { color: var(--orange-dark); border-color: var(--orange); background: var(--orange-soft); }
.sps-mic.recording { background: #fcebeb; color: #c0392b; border-color: #f1c6c6; animation: sps-pulse 1.1s ease-in-out infinite; }
.sps-mic.busy { opacity: .6; pointer-events: none; }
.sps-mic .sps-svg { width: 18px; height: 18px; }
@keyframes sps-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(192,57,43,.35); } 50% { box-shadow: 0 0 0 7px rgba(192,57,43,0); } }

/* ---- Chat ---- */
.sps-chat-card { display: flex; flex-direction: column; }
.sps-chat-thread {
  background: var(--warm); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 18px; margin: 6px 0 16px; min-height: 280px; max-height: 460px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.sps-chat-msg { display: flex; }
.sps-chat-msg .bubble {
  max-width: 78%; padding: 12px 15px; border-radius: 16px; font-size: 15px; line-height: 1.6; white-space: pre-wrap;
}
.sps-chat-msg.ai { justify-content: flex-start; }
.sps-chat-msg.ai .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; color: var(--ink); }
.sps-chat-msg.me { justify-content: flex-end; }
.sps-chat-msg.me .bubble { background: var(--orange); color: #fff; border-bottom-right-radius: 5px; }
.sps-chat-msg.err .bubble { background: #fcebeb; color: #9b2c2c; border: 1px solid #f1c6c6; }
.sps-chat-msg.typing .bubble { color: var(--muted-2); font-style: italic; }

.sps-chat-input { display: flex; align-items: flex-end; gap: 10px; }
.sps-chat-input textarea {
  flex: 1; resize: none; min-height: 48px; max-height: 160px;
  padding: 13px 15px; border: 1.5px solid var(--line); border-radius: 14px;
  font-size: 15px; font-family: inherit; line-height: 1.5;
}
.sps-chat-input textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.sps-chat-input .sps-mic { position: static; flex: none; }
.sps-chat-input .sps-btn { padding: 0; width: 48px; height: 48px; border-radius: 50%; flex: none; }

@media (max-width: 900px) {
  .sps-hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .sps-preview { transform: none; }
  .sps-features { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .sps-hero { padding: 64px 0 48px; }
  .sps-nav a:not(.cta) { display: none; }
  .sps-card { padding: 22px; }
}
