/* Shared styles. Colors are variables (like constants) so branding can change in one place. */
:root {
  --brand: #1a73c8;
  --bg: #eef3f8;
  --text: #1d2733;
  --ok: #1e8a4c;
  --warn: #b26a00;
  --err: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
}

.top {
  background: var(--brand);
  color: #fff;
  padding: 10px 20px;
  font-size: 18px;
  font-weight: bold;
  display: flex;            /* logo on the left, text next to it */
  align-items: center;
  flex-wrap: wrap;          /* on a narrow phone the text drops below the logo */
  gap: 8px 20px;
}
.top img { display: block; max-width: 100%; height: auto; }
.top .phone { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; white-space: nowrap; }

.card {
  max-width: 760px;
  margin: 24px auto;
  padding: 24px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

h1 { margin: 0 0 16px; font-size: 24px; }

.msg { padding: 12px 16px; border-radius: 6px; border-left: 5px solid; }
.msg.error { background: #fdecea; border-color: var(--err); }
.msg.warn  { background: #fff4e0; border-color: var(--warn); }
.msg.ok    { background: #e6f5ec; border-color: var(--ok); }

.info { margin: 0; }
.info dt { color: #667; font-size: 14px; margin-top: 0px; }
.info dd { margin: 0 0 10px; font-size: 16px; font-weight: bold; }
.info dd.good { color: var(--ok); }
.info dd.bad  { color: var(--err); }

/* Two columns side by side; stacked on narrow screens */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 600px) {
  .columns { grid-template-columns: 1fr; gap: 0; }
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
}
.btn:hover { opacity: 0.9; }

/* Phones: use the whole width */
@media (max-width: 600px) {
  .card { margin: 0; border-radius: 0; box-shadow: none; }
}

/* Forms */
label { display: block; margin: 16px 0 6px; color: #667; font-size: 14px; }
input[type=text] {
  width: 100%;
  padding: 10px 12px;
  font-size: 20px;
  border: 1px solid #b8c4d0;
  border-radius: 6px;
}
input[type=text]:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
form .btn { margin-top: 16px; border: 0; font-size: 18px; cursor: pointer; }

/* Row of action buttons under the details (PayNow, SelectService) */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; padding-top: 20px; border-top: 1px solid #e1e8ef; }
.actions form { margin: 0; }
.actions .btn { margin: 0; padding: 12px 24px; font-size: 18px; }
.btn.pay { display: inline-flex; align-items: center; gap: 10px; }   /* icon in front of the text */
.btn .icon { flex: none; }
.btn.secondary { background: #fff; color: var(--brand); border: 2px solid var(--brand); }
@media (max-width: 600px) {
  .actions form, .actions .btn { width: 100%; }   /* full-width buttons on phones */
}

/* Small button placed inside a text line (e.g. next to the status) */
form.inline { display: inline; }
form.inline .btn { margin: 0 0 0 8px; padding: 4px 12px; font-size: 14px; vertical-align: middle; }

/* Client ID entry form: narrow, centered, big touch-friendly field */
form.enter { max-width: 360px; margin: 24px auto 8px; }
form.enter label { margin-top: 0; font-size: 16px; text-align: center; color: var(--text); }
form.enter input[type=text] { text-align: center; letter-spacing: 2px; font-size: 24px; }
form.enter .btn { width: 100%; padding: 12px 20px; }
.msg + form.enter { margin-top: 24px; }

/* Service selection form */
form.select select {
  width: 90%;
  padding: 11px;
  font-size: 16px;
  border: 1px solid #b8c4d0;
  border-radius: 6px;
  background: #fff;
}
form.select { --stepper-w: 132px; }   /* total width of one - [n] + control */
form.select .fields { display: flex; gap: 8px 24px; flex-wrap: wrap; margin-top: 12px; }   /* side by side; one under the other when narrow */
form.select .fields > div { display: flex; align-items: center; gap: 8px; }   /* label and stepper on one row */
form.select .fields label { margin: 0; white-space: nowrap; }

/* - [ value ] + control with big touch-friendly buttons */
.stepper { display: flex; width: var(--stepper-w); }
/* An <input> has a built-in default width; width:0 + flex-grow makes it take only the space left. */
.stepper input[type=text] {
  flex: 1 1 0; width: 0; min-width: 0; padding: 0; text-align: center; font-size: 18px; font-weight: bold;
  border-radius: 0; border-left: 0; border-right: 0;
}
.stepper input[readonly] { background: #f3f6f9; }
.stepper .step {
  flex: none; width: 36px; padding: 0; font-size: 22px; line-height: 1; cursor: pointer;
  background: var(--brand); color: #fff; border: 0;
}
.stepper .step:first-child { border-radius: 6px 0 0 6px; }
.stepper .step:last-child  { border-radius: 0 6px 6px 0; }
.stepper .step:disabled { background: #b8c4d0; cursor: default; }
.stepper input:disabled { background: #f3f6f9; }

/* Extras: a table of 4 columns, as many rows as needed. One column on phones. */
.extras { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 24px; }
@media (max-width: 600px) {
  .extras { grid-template-columns: 1fr; }
}
label.check { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 12.6px; color: var(--text); }
label.check input { width: 22px; height: 22px; flex: none; }
.muted { color: #667; font-size: 14px; }

.price { margin-top: 20px; padding: 12px 16px; background: #eef6ff; border-radius: 6px; }
.price dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; }
.price dt { color: #445; }
.price dd { margin: 0; text-align: right; font-weight: bold; }
.price dd.total { font-size: 22px; color: var(--brand); }
.price dt:nth-last-of-type(1) { font-weight: bold; }
.price p { margin: 8px 0 0; }

/* Steps bar: rounded boxes joined by a line; the current step is filled */
.steps { max-width: 760px; margin: 16px auto 0; padding: 0 16px; }
.steps ol { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; flex: 1; }
.steps li:first-child { flex: none; }
.steps li + li::before { content: ''; flex: 1; min-width: 12px; height: 2px; background: var(--brand); }
.steps .box {
  border: 2px solid var(--brand); border-radius: 8px; background: #fff; color: var(--brand);
  padding: 4px 12px; font-size: 14px; white-space: nowrap;
}
.steps li.current .box { background: var(--brand); color: #fff; }
@media (max-width: 600px) {
  .steps li:not(.current) .name { display: none; }   /* only the number, the current step keeps its name */
  .steps .box { padding: 4px 10px; }
}

/* Promotions: one slide at a time, swipeable */
.promos { margin-top: 24px; }
.promos .strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 8px; }
.promo { flex: 0 0 100%; margin: 0; scroll-snap-align: start; }
.promo img { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: fill; border-radius: 8px; }
.promo figcaption { padding: 8px 4px 0; }
.promo strong { display: block; font-size: 16px; }
.promo span { display: block; font-size: 14px; color: #445; }
.promo a { color: var(--brand); }

/* select_service: tighter vertical spacing (half of the normal gaps) */
.info.tight { display: grid; grid-template-columns: max-content 1fr; gap: 0 8px; align-items: baseline; }   /* value next to its label */
.info.tight dd { margin-bottom: 5px; }                      /* between client number, name and address */
form.select > label { margin: 8px 0 3px; }                  /* "Основна услуга" and "Допълнителни услуги" */
form.select .price { margin-top: 10px; }                    /* above the total pane */
form.select .price dl { row-gap: 2px; line-height: 1.25; }  /* rows of the total pane: half the space */
form.select .price p { margin-top: 2px; }                   /* above "Точната сума...": 80% less */

/* "Моите плащания" in the banner: a link, or a button inside a form (same look) */
.top .mypay, .top form.mypay button {
  color: #fff; background: transparent; border: 2px solid #fff; border-radius: 6px;
  padding: 4px 12px; font: inherit; font-size: 16px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.top .mypay:hover { background: rgba(255, 255, 255, 0.15); }
.top form.mypay { margin: 0; }

/* my_payments: one expandable box per payment */
details.pay { border: 1px solid #d3dde8; border-radius: 8px; margin: 10px 0; background: #fff; }
details.pay summary {
  display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px;
  cursor: pointer; font-weight: bold; list-style: none;
}
details.pay summary::-webkit-details-marker { display: none; }
details.pay summary::before { content: '▸'; margin-right: 8px; color: var(--brand); }
details.pay[open] summary::before { content: '▾'; }
details.pay summary .when { flex: 1; }
details.pay summary .sum { color: var(--brand); white-space: nowrap; }
details.pay[open] summary { border-bottom: 1px solid #e1e8ef; }
details.pay .item { padding: 10px 16px; border-bottom: 1px solid #eef3f8; }
details.pay .item:last-child { border-bottom: 0; }
details.pay .item .line { display: flex; justify-content: space-between; gap: 16px; font-weight: bold; font-size: 16px; }
details.pay .item .note { color: #445; font-size: 14px; margin-top: 2px; word-break: break-word; }

/* my_speed: range buttons, legend and the SVG chart (scales with the width of the card) */
.ranges { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.ranges .btn { padding: 6px 18px; font-size: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 14px; color: #445; margin-bottom: 4px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .down i, svg.speed .down { background: #1a73c8; fill: #1a73c8; }
.legend .up i, svg.speed .up { background: #e08a00; fill: #e08a00; }
svg.speed { display: block; width: 100%; height: auto; }
svg.speed text { font-size: 11px; fill: #556; font-family: inherit; }
svg.speed .grid { stroke: #d3dde8; stroke-width: 1; }
svg.speed .axis { stroke: #99a8b8; stroke-width: 1; }

/* select_service: "Продължи" and "Назад" side by side */
.btnrow { display: flex; flex-wrap: wrap; gap: 0 12px; }
