/* ============================================================
   Verish.Lux.Hotel PMS — style.css
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f8f8f6;
  --surface:   #ffffff;
  --surface2:  #f0efe8;
  --border:    #e0dfd6;
  --border2:   #cccbc2;
  --text:      #1a1a18;
  --text2:     #555550;
  --text3:     #999990;
  --accent:    #534AB7;
  --accent-dk: #3C3489;
  --green:     #1D9E75;
  --green-bg:  #E1F5EE;
  --green-dk:  #085041;
  --red:       #E24B4A;
  --red-bg:    #FCEBEB;
  --red-dk:    #791F1F;
  --amber:     #BA7517;
  --amber-bg:  #FAEEDA;
  --amber-dk:  #633806;
  --gray-bg:   #F1EFE8;
  --gray-bd:   #B4B2A9;
  --gray-dk:   #444441;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 2px 12px rgba(0,0,0,.08);
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Layout ---- */
.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.logo-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text);
}

.logo-sub {
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

#cur-date {
  font-size: 12px;
  color: var(--text3);
}

/* ---- Stats ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
}

.stat-val {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.stat-val.c-green { color: var(--green); }
.stat-val.c-red   { color: var(--red); }
.stat-val.c-amber { color: var(--amber); }

.stat-lbl {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 9px 18px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background .15s;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab:hover:not(.active) {
  background: var(--surface2);
}

/* ---- Sections ---- */
.section { display: none; }
.section.active { display: block; }

/* ---- Floor blocks & Room grid ---- */
.floor-block { margin-bottom: 18px; }

.floor-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.floor-rooms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

/* ---- Room card ---- */
.room-card {
  border-radius: var(--radius);
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform .12s, box-shadow .12s;
  user-select: none;
}

.room-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.room-card:active { transform: scale(.97); }

.room-num  { font-size: 16px; font-weight: 700; }
.room-type { font-size: 10px; margin-top: 2px; opacity: .75; }
.room-guest{ font-size: 10px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }

.r-free  { background: var(--green-bg); border-color: #5DCAA5; color: var(--green-dk); }
.r-busy  { background: var(--red-bg);   border-color: #F09595; color: var(--red-dk);   }
.r-clean { background: var(--amber-bg); border-color: #EF9F27; color: var(--amber-dk); }
.r-block { background: var(--gray-bg);  border-color: var(--gray-bd); color: var(--gray-dk); }

/* ---- Legend ---- */
.legend {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
}

.leg-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ---- Form ---- */
.form-wrap { max-width: 540px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
}

.form-group input,
.form-group select {
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(83,74,183,.12);
}

/* Price preview */
.price-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface2);
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

.price-hint     { color: var(--text3); }
.price-breakdown{ color: var(--text2); }
.price-total    { font-size: 16px; font-weight: 700; color: var(--accent); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  font-size: 13px;
  font-family: inherit;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  transition: background .15s, transform .1s;
  white-space: nowrap;
}

.btn:hover   { background: var(--surface2); }
.btn:active  { transform: scale(.97); }

.btn-primary { background: var(--accent);  color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dk); }

.btn-success { background: var(--green);  color: #fff; border-color: var(--green); }
.btn-success:hover { background: #16875f; }

.btn-danger  { background: var(--red);    color: #fff; border-color: var(--red); }
.btn-danger:hover  { background: #c93c3b; }

.btn-warn    { background: var(--amber);  color: #fff; border-color: var(--amber); }
.btn-warn:hover    { background: #9a6213; }

.btn-ghost   { background: transparent; border-color: var(--border); color: var(--text2); font-size: 12px; }
.btn-ghost:hover { background: var(--surface2); }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }

.res-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 680px;
}

.res-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.res-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.res-table tr:last-child td { border-bottom: none; }
.res-table tr:hover td { background: var(--surface2); }

.col-id  { color: var(--text3); font-size: 11px; }
.col-sum { font-weight: 600; }

.guest-name { font-weight: 500; }
.guest-sub  { font-size: 11px; color: var(--text3); }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-new { background: #E6F1FB; color: #0C447C; }
.badge-in  { background: var(--green-bg); color: var(--green-dk); }
.badge-out { background: var(--gray-bg);  color: var(--gray-dk);  }

/* ---- Modal ---- */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: min(460px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
}

.modal-meta {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 12px;
}

.modal-hint {
  font-size: 13px;
  color: var(--text2);
  padding: 12px;
  background: var(--surface2);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* Folio */
.folio-guest  { margin-bottom: 12px; }
.folio-name   { font-weight: 600; font-size: 14px; }
.folio-dates  { font-size: 12px; color: var(--text2); margin-top: 2px; }
.folio-company{ font-size: 12px; color: var(--text3); }

.folio-box {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.folio-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text2);
}

.folio-total {
  display: flex;
  justify-content: space-between;
  padding: 8px 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ---- Toast notifications ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  background: var(--text);
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  box-shadow: var(--shadow);
  max-width: 320px;
}

.toast.show      { opacity: 1; transform: translateY(0); }
.toast-success   { background: var(--green); }
.toast-info      { background: var(--accent); }
.toast-error     { background: var(--red); }

/* ---- Toolbar (под таблицей) ---- */
.toolbar {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ---- Empty state ---- */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text3);
  font-size: 13px;
}

/* ---- Responsive ---- */
@media (max-width: 700px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .floor-rooms {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}
