/* base.css: layout + spacing global */
.building-btn { margin-bottom: 10px; }
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border: 1px solid #ddd; padding: 8px; text-align: center; }
.table th { background-color: #f2f2f2; }
.footer { padding: 0.5rem 1rem; background-color: #f5f5f5; line-height: 1.5; text-align: center; white-space: normal; }

.footer-text {
  white-space: nowrap;
  font-size: clamp(10px, 2vw, 16px);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.booked { cursor: pointer; }
.empty { cursor: pointer; }

.page-content {
    flex: 1;
    padding: 60px 20px 20px 20px;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    flex: 1;  
}

.page-content h1 {
    margin-bottom: 1.5rem;
}

#loginStatus,
#loginButton {
    display: inline-block;
    font-size: 1.2rem;
}

.text-center.my-3 + .text-center.my-3 {
    margin-top: 1rem !important;  /* ! overrides Bootstrap my-3 */
}



/* Toast / notification styles */
#toastContainer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: auto;
  max-width: 90%;
  align-items: center;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: 720px;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  color: inherit;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
  opacity: 0.98;
}

/* icon square */
.toast .icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* message and optional details */
.toast .msg {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.toast .msg .title {
  font-weight: 600;
}
.toast .msg .details {
  margin-top: 6px;
  font-size: 12px;
  color: inherit;
  display: none;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  border-radius: 4px;
}

/* small screen adjustments */
@media (max-width: 420px) {
  #toastContainer { bottom: 12px; }
  .toast { min-width: 220px; padding: 8px; }
  .toast .icon { width: 32px; height: 32px; font-size: 14px; }
}

/* User Calendar popup */
#myBookingsContainer.modal-backdrop-custom {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    overflow-y: auto;
}

#myBookingsContainer .modal-dialog {
    max-width: 600px;
    width: 90%;
}

#myBookingsContainer.modal-backdrop-custom .modal-dialog {
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
}

#myBookingsContainer.modal-backdrop-custom .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    padding: 1rem;
}

/* Center heading and table */
#myBookingsContainer h2#myBookingsTitle {
    text-align: center;
    margin-bottom: 1rem;
}

#myBookingsContainer .table-responsive {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Subscribe modal */
#subscribeCalendarModal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#subscribeCalendarModal .d-flex.justify-content-between.mb-3 {
    justify-content: center !important;
    gap: 1rem;
}

#subscribeCalendarModal .d-flex.justify-content-end.mt-3 {
    justify-content: flex-start !important;
    gap: 0.5rem;
}

.url-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.url-box input {
    flex: 1;
    padding-right: 0;
    overflow-x: auto;
    white-space: nowrap;
}

.url-box .copy-btn {
    position: static;
    transform: none;
    z-index: auto;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Theme toggle icon */
.theme-icon {
  display: inline-block;
  transition: opacity 0.2s ease;
  font-size: 1.2rem;
}

@keyframes spinOvershoot {
  0% { transform: rotate(0deg); }
  70% { transform: rotate(400deg); }
  90% { transform: rotate(350deg); }
  100% { transform: rotate(360deg); }
}

.theme-spin {
  animation: spinOvershoot 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* transition for theme change */
* {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

#topControls {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1100;
}

/* Theme button style */
.theme-btn {
    font-size: 1.2rem;
}

/* Language toggle slider */
.lang-switch {
    position: relative;
    width: 70px;
    height: 30px;
    align-items: center;
    justify-content: center;
}

.lang-switch input {
    position: absolute;  /* remove from flow */
    opacity: 0;
    width: 0;
    height: 0;
}

.lang-switch label {
    display: block;
    background-color: #ddd;
    border-radius: 15px;
    cursor: pointer;
    position: relative;
    height: 100%;
}

.lang-switch label::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    left: 1px;
    top: 50%;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    transform: translateY(-50%);
}

.lang-switch input:checked + label::after {
    transform: translateX(40px) translateY(-50%);
}


.lang-switch .lang-en,
.lang-switch .lang-de {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: bold;
    pointer-events: none;
}

.lang-switch .lang-en { left: 8px; color: #333; }
.lang-switch .lang-de { right: 8px; color: #333; }

.lang-switch-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid transparent;
    background-color: transparent;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}


/* Long press shake */
@keyframes btn-shake-random {
  0%   { transform: translate(0,0) rotate(0deg) scale(1); }
  7%   { transform: translate(-1px, 0.6px) rotate(-1deg) scale(1.002); }
  14%  { transform: translate(1.6px, -0.8px) rotate(0.8deg) scale(0.998); }
  21%  { transform: translate(-1.2px, 1.4px) rotate(-0.6deg) scale(1.004); }
  29%  { transform: translate(1px, 0.8px) rotate(0.5deg) scale(0.996); }
  36%  { transform: translate(-0.6px, -1.2px) rotate(-1.2deg) scale(1.003); }
  44%  { transform: translate(1.4px, -0.4px) rotate(0.6deg) scale(1.001); }
  51%  { transform: translate(-0.8px, 1.6px) rotate(-0.4deg) scale(0.997); }
  59%  { transform: translate(0.6px, -1px) rotate(1.1deg) scale(1.003); }
  66%  { transform: translate(-1.6px, 0.4px) rotate(-0.9deg) scale(1.002); }
  74%  { transform: translate(1.2px, 1px) rotate(0.7deg) scale(0.999); }
  82%  { transform: translate(-0.4px, -1.6px) rotate(-0.5deg) scale(1.004); }
  89%  { transform: translate(0.8px, 0.6px) rotate(1deg) scale(1); }
  100% { transform: translate(0,0) rotate(0deg) scale(1); }
}

#logoutButton.is-shaking {
  animation: btn-shake-random 0.6s linear infinite;
}

/* Armed delete mode */
#logoutButton.delete-armed {
  background-color: #b00020 !important;
  border-color: #b00020 !important;
}

@keyframes btn-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(176,0,32,0.45); }
  100% { box-shadow: 0 0 0 14px rgba(176,0,32,0); }
}
#logoutButton.delete-armed {
  animation: btn-pulse 1.2s ease-out infinite;
}

/* pop when switching to Delete */
@keyframes pop-once {
  0%   { transform: scale(0.96); }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1.0); }
}
#logoutButton.pop {
  animation: pop-once 160ms ease-out;
}

/* Delete modal visuals */
.delete-modal {
  padding: 1.2rem 1.2rem 1.6rem;
}

.delete-warning-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.delete-title {
  color: #b00020;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.delete-note {
  margin: 0.5rem auto 1.25rem;
  max-width: 520px;
}

/* Nuke switch */
.nuke-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  height: 140px;
  margin: 0.5rem auto 0.75rem;
  perspective: 900px;
}

.nuke-btn {
  position: relative;
  z-index: 1;
  width: 200px;
  height: 68px;
  border-radius: 999px;
  border: none;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(#e53935, #b71c1c);
  box-shadow: 0 8px 20px rgba(183, 28, 28, 0.45), inset 0 -6px 12px rgba(0,0,0,0.25);
  transition: transform 0.06s ease, filter 0.12s ease, opacity 0.2s ease;
}

.nuke-btn:active {
  transform: translateY(1px) scale(0.995);
}

.nuke-btn:disabled {
  opacity: 0.6;
  filter: grayscale(0.2);
  cursor: not-allowed;
}

.nuke-cover {
  position: absolute;
  z-index: 2;
  width: 210px;
  height: 90px;
  top: 10px;
  border: none;
  background: linear-gradient(180deg, rgba(220,0,20,0.7), rgba(120,0,10,0.85));
  border-radius: 10px;
  box-shadow:
    0 10px 24px rgba(0,0,0,0.35),
    inset 0 2px 10px rgba(255,255,255,0.18);
  transform-origin: top center;
  transform: rotateX(0deg) translateZ(0);
  transition: transform 380ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
  cursor: pointer;
}

.nuke-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0) 50%);
  pointer-events: none;
}

.nuke-cover.open {
  transform: rotateX(72deg) translateY(-6px);
  box-shadow:
    0 18px 36px rgba(0,0,0,0.35),
    inset 0 2px 10px rgba(255,255,255,0.18);
}

/* vibration */
.nuke-cover:not(.open):hover {
  animation: cover-wobble 0.7s ease-in-out infinite;
}
@keyframes cover-wobble {
  0% { transform: rotateX(0deg) translateY(0); }
  50% { transform: rotateX(2deg) translateY(-1px); }
  100% { transform: rotateX(0deg) translateY(0); }
}

/* Password area spacing */
.delete-pw-area {
  margin-top: 0.75rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* Screenreader helper */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ================================
   STATUS — modal
   ================================ */

#statusModal .modal-dialog {
  max-width: 960px;
}

.status-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .45rem .7rem;
  background: transparent;
  border: 1px solid;
  border-radius: .75rem;
  cursor: pointer;
}
.status-label {
  font-size: .82rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* =========================
   Heart / ECG base structure
   ========================= */
.heart-wrap {
  position: relative;
  width: 64px;
  height: 56px;
}

.status-mini .heart-wrap {
  width: 40px;
  height: 35px;
}

.heart-bg {
  display: block;
  position: relative;
  z-index: 1;
}

.ecg {
  position: absolute;
  left: 2px; right: 2px; top: 50%;
  transform: translateY(-50%);
  width: calc(100% - 4px);
  height: 24px;
  overflow: visible;
  z-index: 2;
}

.ecg-line {
  stroke: currentColor; 
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  stroke-linecap: round;
}

@keyframes ecg-move {
  0%   { stroke-dasharray: 12 180; stroke-dashoffset: 0; }
  50%  { stroke-dasharray: 60 132; stroke-dashoffset: -40; }
  100% { stroke-dasharray: 12 180; stroke-dashoffset: -120; }
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  25%      { transform: scale(1.04); }
  50%      { transform: scale(1); }
  75%      { transform: scale(1.05); }
}

.status-btn.working .ecg-line,
.status-mini.working .ecg-line { animation: ecg-move 1.4s linear infinite; }

.status-btn.working .heart-bg,
.status-mini.working .heart-bg { transform-origin: center; animation: beat 1.4s ease-in-out infinite; }

.status-btn.broken .ecg-line,
.status-mini.broken .ecg-line { animation: none; }

/* Alert badge */
.warning-badge {
  position: absolute;
  right: -2px;
  top: -6px;
  font-size: 16px;
  line-height: 1;
  display: none;     
  z-index: 3;       
  pointer-events: none;
}

.status-btn.broken .warning-badge,
.status-mini.broken .warning-badge {
  display: inline-block;
}

.status-duo {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
}
.status-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 240px;
}
.status-unit .status-mini {
  margin: 0 auto;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

/* =========================================
    buildings status
   ========================================= */
.status-matrix .matrix-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  align-items: center;
  text-align: center;
  margin-bottom: .35rem;
}

.status-matrix .matrix-row.hearts > div {
  display: flex;
  justify-content: center;
  align-items: center;
}
.status-matrix .status-mini .heart-wrap {
  width: 40px;
  height: 35px;
}

.status-matrix .matrix-row.labels > div { font-weight: 700; }
.status-matrix .matrix-row.states > div { font-size: .95rem; }

.status-btn.status-compact {
  padding: .375rem .5rem;
  border-radius: .25rem;
  line-height: 1.2;
}

.status-btn.status-compact .heart-wrap {
  width: 32px;
  height: 28px;
}

.status-btn.status-compact .status-label {
  font-size: .72rem;
  margin-bottom: 2px;
  letter-spacing: .05em;
}

#statusModal .modal-footer { justify-content: flex-start; }

#myBookingsModal .modal-body .d-flex button + button {
  margin-left: 0.75rem;
}

/* === delete modal red backdrop === */
@keyframes backdropToRed {
  from { background-color: rgba(0, 0, 0, 0.50); }
  to   { background-color: rgba(120, 0, 20, 0.48); }
}

/* on close */
@keyframes backdropFromRed {
  from { background-color: rgba(120, 0, 20, 0.48); }
  to   { background-color: rgba(0, 0, 0, 0.50); }
}

/* prevent Bootstrap default fade */
.modal-backdrop.backdrop-danger-active {
  opacity: 1 !important;
  background-color: rgba(0, 0, 0, 0.50);
  animation: backdropToRed 2s ease forwards;
}

/* on close */
.modal-backdrop.backdrop-danger-out {
  animation: backdropFromRed 220ms ease forwards;
}

/* === Auth cooldown UI === */
.is-cooldown {
  opacity: 0.55 !important;
  filter: grayscale(0.2);
  pointer-events: none;
}

.cooldown-msg {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.85rem;
  color: #b00020; /* red */
}
.cooldown-msg.block {
  display: block;
  margin: 6px 0 0 0;
}
