/* Базови настройки */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #f3f4f6; /* леко сиво */
  color: #111827; /* тъмно сиво */
}

/* Layout – страницата да запълва целия екран */
.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  background: #111827;
  color: #f9fafb;
  padding: 0.75rem 1rem;
}

.site-header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title-main {
  font-size: 1.3rem;
  font-weight: 600;
}

/*снимка за фон*/

/* Навигация – за по-натам */
.site-nav a {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.9rem;
  margin-left: 0.75rem;
}

.site-nav a:hover {
  text-decoration: underline;
}

/* Основно съдържание */
.site-main {
  flex: 1;
  //padding: 1rem;
}

.site-main > * {
  max-width: 1700px;
  margin: 0 auto;
}

/* Footer */
.site-footer {
  background: #1f2933;
  color: #9ca3af;
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
}

/* Базов контейнер, който можем да ползваме по страниците */
.page-card {
  background: #ffffff;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

/* Формуляри – за CRUD-овете по-нататък */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.form-row label {
  font-size: 0.85rem;
  color: #374151;
}

.form-row input,
.form-row textarea,
.form-row select {
  padding: 0.5rem 0.6rem;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb33;
}
.form-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
}

.form-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.booking-delivery-fields {
  margin: 0 0 0.75rem;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
}

.booking-delivery-fields legend {
  padding: 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #111827;
}

.booking-delivery-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.booking-delivery-checkbox input {
  margin: 0;
}

.booking-delivery-checkbox label {
  color: #374151;
}

.booking-delivery-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 0.9rem;
}

.booking-delivery-kg-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #374151;
  font-size: 0.85rem;
}

.booking-delivery-kg-inline .booking-delivery-kg-input {
  width: 6.5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.9rem;
}

.booking-delivery-kg-inline .booking-delivery-kg-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb33;
}

/* Ред с две колони вътре */
.form-row-inline {
  flex-direction: row;
  gap: 0.75rem;
  align-items: flex-start;
}

/* Всяка колона вътре в реда */
.form-row-inline .form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem; /* същото като в .form-row */
}

/* На малки екрани да падат една под друга */
@media (max-width: 768px) {
  .form-row-inline {
    flex-direction: column;
  }
}

.client-block {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-top: 0.75rem;
  transition: opacity 0.15s ease;
}

.client-block--active {
  opacity: 1;
}

.client-block--inactive {
  opacity: 0.5;
}
.client-block-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* половин ширина за полетата в блока */
.form-row--half {
  flex: 1 1 0;
}

/* заглавието да изглежда като останалите label-и */
.form-row--block-title {
  flex-direction: row;
  justify-content: space-between;
  align-items: baseline;
}

.client-block-title {
  font-size: 0.9rem;
  color: #111827;
}

.client-block-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
}
/* Бутон – мобилен-friendly */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.9rem;
  border-radius: 0.375rem;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}
/* Контейнер около таблицата – за скрол и рамка */
.table-wrapper {
  overflow: auto; /* и хоризontal, и vertical ако трябват */
  max-height: 70vh; /* по желание – да не заема целия екран */
  border: 1px solid #d1d5db; /* рамка около таблицата */
  border-radius: 4px;
  background: #f9fafb;
}

/* Основен стил за таблицата */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

/* Клетки – общ стил */
.data-table th,
.data-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

/* Хедър на таблицата */
.data-table thead tr {
  background: #d5dfca;
}

.data-table thead th {
  font-weight: 600;
}

/* редуване на редовете – ако искам през CSS, а не през Twig */
.data-table tbody tr:nth-child(even) {
  background: #dce3ce;
}

/* Sticky хедър (горен ред) */
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background-color: #c9d7bc; /* постоянен фон за горния ред */
}

/* Sticky първа колона */
.data-table .col-sticky {
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 2;
  background-color: #c9d7bc; /* постоянен фон */
  box-shadow: 1px 0 0 #e5e7eb; /* фин деликатен разделител вдясно */
}

/* Ако хедърът е и първа колона – да стои най-отгоре */
.data-table .col-sticky-header {
  z-index: 4;
  background-color: #c9d7bc; /* може още една идея по-тъмно */
  box-shadow:
    1px 0 0 #e5e7eb,
    -1px 0 0 #e5e7eb;
}

.booking-wrapper {
  max-height: 80vh; /* колкото ти е удобно */
  overflow: auto;
  position: relative;
}
.booking-table {
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
}

.booking-slot-time {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.4rem;
  padding: 0.1rem 0.35rem 0;
}

.booking-slot-time-value {
  font-weight: 600;
}

.booking-delivery-indicators {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 0.15rem;
}

.booking-delivery-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
}

.booking-delivery-indicator img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.booking-delivery-print-link {
  display: inline-flex;
  border-radius: 0.25rem;
  transition:
    transform 0.12s ease,
    filter 0.12s ease;
}

.booking-delivery-print-link:hover,
.booking-delivery-print-link:focus-visible {
  transform: scale(1.12);
  filter: brightness(1.08);
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.booking-history-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid #2563eb;
  border-radius: 50%;
  color: #1d4ed8;
  background: rgba(255, 255, 255, 0.8);
  font-family: Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.booking-history-indicator:hover,
.booking-history-indicator:focus-visible {
  color: #fff;
  background: #2563eb;
  outline: none;
}

.booking-edit-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.booking-edit-heading h1 {
  margin: 0;
}

.booking-action-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid #9ca3af;
  border-radius: 0.25rem;
  color: #1f2937;
  background: #f9fafb;
  text-decoration: none;
}

.booking-action-link:hover,
.booking-action-link:focus-visible {
  background: #f3f4f6;
}

.booking-history-page {
  max-width: 900px;
}

.booking-history-heading h1 {
  margin: 0;
}

.booking-history-heading p {
  margin: 0.35rem 0 1.25rem;
  color: #6b7280;
}

.booking-history-entry {
  margin: 0 0 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.4rem;
  overflow: hidden;
  background: #fff;
}

.booking-history-entry > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.65rem 0.8rem;
  background: #eef3e9;
}

.booking-history-entry > header span {
  color: #4b5563;
  font-size: 0.85rem;
  text-align: right;
}

.booking-history-table-wrapper {
  overflow-x: auto;
}

.booking-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.booking-history-table th,
.booking-history-table td {
  padding: 0.55rem 0.8rem;
  border-top: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.booking-history-table thead th {
  color: #6b7280;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.booking-history-table tbody th {
  width: 24%;
  font-weight: 600;
}

.booking-history-table tbody td {
  width: 38%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.booking-history-empty {
  color: #9ca3af;
}

.booking-history-no-entries {
  padding: 1rem;
  border: 1px dashed #9ca3af;
  border-radius: 0.4rem;
  color: #6b7280;
}

.booking-history-back {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.25rem 0 0;
}

/* общо за sticky header-клетките */
.booking-sticky-header {
  position: sticky;
  top: 0;
  z-index: 4;
  background-color: #f9fafb;
}

.booking-sticky-header-main {
  z-index: 4;
}

/* първа колона (казаните) */
.booking-sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background-color: #f3f4f6;
  box-shadow: 1px 0 0 #e5e7eb; /* визуална линия вдясно */
}
/* ъгловата клетка – горе вляво ("Казани ↓") */
.booking-sticky-intersection {
  z-index: 5;
  /* малко по-дебел „рамкиращ“ ефект */
  box-shadow:
    1px 0 0 #e5e7eb,
    0 1px 0 #e5e7eb,
    -1px 0 0 #e5e7eb;
}

.booking-sticky-col.booking-sticky-header {
  z-index: 5;
  box-shadow:
    1px 0 0 #e5e7eb,
    -1px 0 0 #e5e7eb;
}

/* Контейнер за таблица – за хоризонтален скрол при малки екрани */
.report-table-wrapper {
  overflow-x: auto;
  margin-top: 0.5rem;
}

/* Общ стил за таблиците в справките */
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background-color: #ffffff;
}

/* Клетки */
.report-table th,
.report-table td {
  padding: 0.45rem 0.6rem;
  border: 1px solid #e5e7eb;
  white-space: nowrap; /* Да не се чупят заглавията – по-четливо */
}

/* Хедър */
.report-table thead th {
  background: #d5dfca; /* същото зеленикаво като при клиентите */
  font-weight: 600;
}

/* Зебра за редовете */
.report-table tbody tr:nth-child(even) {
  background: #f3f4f6;
}

/* Подравнявания */
.report-table .text-right {
  text-align: right;
}
.report-table .text-center {
  text-align: center;
}

@media (max-width: 640px) {
  .site-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    margin-left: 0;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .site-user {
    margin-left: 0;
    width: 100%;
  }

  .site-main {
    padding: 0.75rem;
  }

  .page-card {
    padding: 0.75rem;
  }

  .booking-toolbar {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .booking-table {
    font-size: 0.8rem;
  }

  .booking-history-entry > header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .booking-history-entry > header span {
    text-align: left;
  }
}
