/* =========================================================
   Premium iOS-like theme for Streamlit + custom components
   Target: Apple Store app / iOS Settings
   ========================================================= */

/* ---------- iOS Tokens ---------- */
:root{
  --bg: #FBFBFD;              /* off-white app background */
  --surface: #FFFFFF;         /* card surface */
  --surface-2: #F2F2F7;       /* iOS grouped background */
  --muted: #6B7280;
  --text: #0F172A;
  --border: rgba(15, 23, 42, 0.08);

  --blue: #007AFF;            /* iOS System Blue */
  --blue-soft: #F2F8FF;       /* very light blue selection */
  --shadow: 0 4px 20px rgba(0,0,0,0.05);
  --shadow-focus: 0 6px 26px rgba(0,0,0,0.10);

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

/* ---------- Global typography + background ---------- */
html, body{
  background: var(--bg) !important;
  color: var(--text) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

*{ box-sizing: border-box; }

/* Streamlit app shell */
.stApp{
  background: var(--bg) !important;
}

/* Main container spacing */
main .block-container{
  max-width: 980px;
  padding-top: 24px;
  padding-bottom: 28px;
}

/* Make headers feel less "bootstrapped" */
h1, h2, h3, h4, h5, h6, p, label, span, div{
  letter-spacing: -0.01em;
}

/* ---------- Buttons (pill, flat, iOS-like) ---------- */
.stButton > button,
button[kind="primary"],
button[kind="secondary"]{
  border-radius: 50px !important;
  border: 1px solid rgba(15, 23, 42, 0.10) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04) !important;
  padding: 10px 16px !important;
  font-weight: 700 !important;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease, background .15s ease;
}

.stButton > button:hover,
button[kind="primary"]:hover,
button[kind="secondary"]:hover{
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06) !important;
}

.stButton > button:active,
button[kind="primary"]:active,
button[kind="secondary"]:active{
  transform: translateY(0px);
  filter: brightness(0.98);
}

/* Primary button */
.stButton > button[data-testid="baseButton-primary"],
button[kind="primary"]{
  background: var(--blue) !important;
  color: #FFFFFF !important;
  border-color: rgba(0,0,0,0) !important;
}

/* ---------- Inputs / Selects (native-like) ---------- */
/* BaseWeb input wrapper */
div[data-baseweb="input"] > div{
  background: var(--surface-2) !important;
  border: 1px solid rgba(0,0,0,0) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: none !important;
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}

div[data-baseweb="input"] input{
  background: transparent !important;
  font-weight: 600;
}

/* Focus state: white + soft shadow */
div[data-baseweb="input"] > div:focus-within{
  background: var(--surface) !important;
  box-shadow: var(--shadow-focus) !important;
  transform: translateY(-1px);
}

/* Textarea */
textarea{
  background: var(--surface-2) !important;
  border: 1px solid rgba(0,0,0,0) !important;
  border-radius: var(--radius-sm) !important;
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}

textarea:focus{
  outline: none !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-focus) !important;
}

/* Select (dropdown) */
div[data-baseweb="select"] > div{
  background: var(--surface-2) !important;
  border: 1px solid rgba(0,0,0,0) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: none !important;
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}

div[data-baseweb="select"] > div:focus-within{
  background: var(--surface) !important;
  box-shadow: var(--shadow-focus) !important;
  transform: translateY(-1px);
}

/* ---------- Cards / containers (floating grouped iOS feel) ---------- */
.panel{
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow) !important;
  padding: 26px 26px 18px 26px;
}

.page{
  max-width: 980px;
  margin: 28px auto;
  padding: 0 16px;
}

/* Headings */
.h1{
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px 0;
}
.h2{
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 22px 0;
}

/* ---------- 1) Stepper: connected segmented control ---------- */
.stepper{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;

  background: #E5E5EA; /* iOS inactive fill */
  border-radius: 18px;
  padding: 6px;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.step{
  display:flex;
  align-items:center;
  justify-content:center;
  position: relative;
  padding-top: 0;
}

/* Remove old connector lines */
.step:before,
.step:after{
  content: none !important;
  display: none !important;
}

/* Make each step look like a pill segment */
.step-inner{
  width: 100%;
  display:flex;
  flex-direction: row;
  align-items:center;
  justify-content:center;
  gap: 8px;

  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.65);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.step-circle{
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 800;
  font-size: 13px;
  border: 0 !important;
  background: #E5E5EA;     /* inactive */
  color: #3A3A3C;          /* iOS dark grey */
}

.step-label{
  margin-top: 0;
  font-size: 13px;
  font-weight: 800;
  color: #3A3A3C;
}

/* Active step: solid iOS blue with white text */
.step.active .step-inner{
  background: rgba(0,122,255,0.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.step.active .step-circle{
  background: var(--blue) !important;
  color: #FFFFFF !important;
}

.step.active .step-label{
  color: var(--blue) !important;
}

/* Optional hover polish */
.step:hover .step-inner{
  transform: translateY(-1px);
}

/* ---------- 2) Selection cards: large iOS tiles ---------- */
.cards{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.home-card{
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  padding: 18px 16px;
  cursor: pointer;
  background: var(--surface) !important;
  box-shadow: var(--shadow) !important;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  min-height: 128px;
  display:flex;
  gap: 14px;
  align-items: center;
}

.home-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.06) !important;
}

/* Selection state: subtle blue ring + light blue bg */
.home-card.selected{
  background: var(--blue-soft) !important;
  border-color: rgba(0,122,255,0.35) !important;
  box-shadow: 0 0 0 2px rgba(0,122,255,0.45), var(--shadow) !important;
}

.icon{
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,122,255,0.12);
  font-size: 22px;
}

.card-title{
  font-weight: 900;
  font-size: 15px;
}
.card-subtitle{
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- 3) Product list + quantity stepper (iOS steppers) ---------- */
/* Grouped sections (if you wrap product list in your own container) */
.section-card,
.product-card{
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow) !important;
}

/* Number input: make +/- look like iOS stepper buttons */
div[data-testid="stNumberInput"] div[data-baseweb="input"] > div{
  border-radius: 14px !important;
}

/* Streamlit number input buttons often render as adjacent buttons */
div[data-testid="stNumberInput"] button{
  border-radius: 12px !important;
  border: 1px solid rgba(15, 23, 42, 0.10) !important;
  background: var(--surface) !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04) !important;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

div[data-testid="stNumberInput"] button:hover{
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06) !important;
}

/* ---------- 4) Modal / Quote request: glassmorphism ---------- */
/* Dialog container (covers st.dialog and some modal variants) */
div[data-testid="stDialog"] > div,
div[role="dialog"]{
  border-radius: 20px !important;
  border: 1px solid rgba(255,255,255,0.35) !important;
  background: rgba(255,255,255,0.78) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.20) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Overlay if present (varies by Streamlit version, so we cover common cases) */
div[data-testid="stDialogOverlay"],
div[data-testid="stModalOverlay"],
div[aria-modal="true"]{
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Inputs inside dialogs: iOS fields */
div[data-testid="stDialog"] input,
div[data-testid="stDialog"] textarea,
div[role="dialog"] input,
div[role="dialog"] textarea{
  background: var(--surface-2) !important;
  border: 1px solid rgba(0,0,0,0) !important;
  border-radius: var(--radius-sm) !important;
  transition: background .18s ease, box-shadow .18s ease;
}

div[data-testid="stDialog"] input:focus,
div[data-testid="stDialog"] textarea:focus,
div[role="dialog"] input:focus,
div[role="dialog"] textarea:focus{
  outline: none !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-focus) !important;
}

/* "Copy to Clipboard" box: receipt-like code block */
.codebox,
pre,
code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
}

.codebox{
  background: #0B1220;
  color: #E5E7EB;
  padding: 14px;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.08);
  overflow:auto;
}

/* Streamlit's default code blocks */
pre{
  background: #0B1220 !important;
  color: #E5E7EB !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18) !important;
}

/* ---------- Pills (if you use them in the UI) ---------- */
.pill{
  border: 1px solid var(--border) !important;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--surface) !important;
  font-weight: 800;
  font-size: 13px;
  color: var(--text) !important;
  display:flex;
  align-items:center;
  gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.pill:hover{
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.05);
}

.pill.selected{
  background: var(--blue) !important;
  color: #FFFFFF !important;
  border-color: rgba(0,0,0,0) !important;
}

.pill .dot{
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(58,58,60,0.35);
  display:inline-block;
}
.pill.selected .dot{
  border-color: #FFFFFF;
  background: #FFFFFF;
}

/* ---------- Subtle separators ---------- */
.hr{
  height: 1px;
  background: rgba(15, 23, 42, 0.06);
  margin: 18px 0 14px 0;
}

/* ---------- Footer buttons (your custom classes) ---------- */
.btn{
  border: 0;
  background: transparent;
  cursor:pointer;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 50px;
}

.btn.back{
  color: #6B7280;
}
.btn.back:hover{
  background: rgba(0,0,0,0.04);
}

.btn.next{
  background: var(--blue);
  color: #fff;
  padding: 11px 18px;
  display:flex;
  align-items:center;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(0,122,255,0.22);
}
.btn.next:hover{
  filter: brightness(0.98);
}

/* ---------- Safety: remove any old decorative connector artifacts ---------- */
.stepper::before, .stepper::after,
.step::before, .step::after{
  content: none !important;
  display: none !important;
}
/* DASH FIX: mobile stepper horizontal scroll (override everything) */
@media (max-width: 640px){
  .stepper{
    display: flex !important;          /* musi być flex, nie grid */
    flex-wrap: nowrap !important;
    overflow-x: auto !important;       /* klucz */
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;

    /* jeśli masz sticky, zostaw */
    position: sticky;
    top: 0;
    z-index: 1000;

    scrollbar-width: none;             /* Firefox */
  }
  .stepper::-webkit-scrollbar{         /* Chrome/Safari */
    display: none;
    width: 0;
    height: 0;
  }

  .step{
    flex: 0 0 auto !important;         /* żeby nie rozciągało */
    min-width: 120px !important;       /* dopasuj np. 110-150 */
  }
}
