/* ============================================================
   Srovnávačka – cloud UI (přihlášení, ukládání, mobil)
   ============================================================ */

:root {
  --cloud-ink: #0f172a;
  --cloud-muted: #64748b;
  --cloud-line: #e2e8f0;
  --cloud-soft: #f8fafc;
  --cloud-orange: #f15a24;
  --cloud-teal: #0d9488;
  --cloud-red: #dc2626;
}

[hidden] {
  display: none !important;
}

body.cloud-modal-open {
  overflow: hidden;
}

.cloud-topbar {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 18px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--cloud-line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--cloud-ink);
}

.cloud-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.cloud-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}

.cloud-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.cloud-brand-text strong {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.cloud-brand-text small {
  font-size: 10px;
  color: var(--cloud-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.cloud-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cloud-user-label {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--cloud-muted);
}

.cloud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cloud-btn-ghost {
  background: #fff;
  border-color: var(--cloud-line);
  color: var(--cloud-ink);
}

.cloud-btn-ghost:hover {
  background: var(--cloud-soft);
}

.cloud-btn-primary {
  background: #0f172a;
  color: #fff;
}

.cloud-btn-primary:hover {
  background: #1e293b;
}

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

.cloud-btn-danger:hover {
  background: #fef2f2;
}

/* ---------- modals ---------- */

.cloud-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--cloud-ink);
}

.cloud-modal {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.5);
  overflow: hidden;
  animation: cloud-modal-in 0.18s ease-out;
}

.cloud-modal-wide {
  max-width: 620px;
}

@keyframes cloud-modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
}

.cloud-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--cloud-line);
}

.cloud-eyebrow {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cloud-orange);
  margin-bottom: 4px;
}

.cloud-modal h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.cloud-modal-head p {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--cloud-muted);
}

.cloud-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 2px solid var(--cloud-line);
  border-radius: 50%;
  background: #fff;
  color: var(--cloud-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.cloud-close:hover {
  background: var(--cloud-soft);
  color: var(--cloud-ink);
}

.cloud-modal-body {
  padding: 18px 20px 20px;
  overflow-y: auto;
}

.cloud-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--cloud-line);
  border-radius: 11px;
  background: #fff;
  color: var(--cloud-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.cloud-google-btn:hover {
  background: var(--cloud-soft);
}

.cloud-google-g {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--cloud-line);
  color: #4285f4;
  font-weight: 900;
  font-size: 12px;
}

.cloud-divider {
  position: relative;
  text-align: center;
  margin: 16px 0;
}

.cloud-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--cloud-line);
}

.cloud-divider span {
  position: relative;
  padding: 0 9px;
  background: #fff;
  font-size: 10px;
  color: var(--cloud-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cloud-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.cloud-field > span {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
}

.cloud-input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: var(--cloud-ink);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cloud-input:focus {
  border-color: var(--cloud-teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.13);
}

.cloud-submit {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  background: var(--cloud-teal);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}

.cloud-submit:hover {
  background: #0f766e;
}

.cloud-submit:disabled,
.cloud-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cloud-link {
  display: block;
  width: 100%;
  margin-top: 9px;
  border: 0;
  background: transparent;
  color: var(--cloud-teal);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.cloud-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cloud-error {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: #fef2f2;
  color: #b42318;
  font-size: 11.5px;
  line-height: 1.4;
}

.cloud-error.cloud-success {
  background: #ecfdf5;
  color: #047857;
}

.cloud-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #334155;
  margin: 4px 0 10px;
  cursor: pointer;
}

.cloud-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--cloud-teal);
}

.cloud-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--cloud-line);
}

.cloud-modal-actions .cloud-submit {
  width: auto;
  padding: 0 18px;
}

.cloud-saved-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.cloud-saved-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cloud-saved-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid var(--cloud-line);
  border-radius: 11px;
  background: #fff;
}

.cloud-saved-item:hover {
  background: var(--cloud-soft);
}

.cloud-saved-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--cloud-ink);
}

.cloud-saved-open strong {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cloud-saved-open span {
  font-size: 10.5px;
  color: var(--cloud-muted);
}

.cloud-saved-delete {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff;
  color: var(--cloud-red);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.cloud-saved-delete:hover {
  background: #fef2f2;
}

.cloud-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 28px 16px;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: var(--cloud-muted);
}

.cloud-empty strong {
  color: var(--cloud-ink);
  font-size: 13px;
}

.cloud-empty span {
  font-size: 11.5px;
}

.cloud-loading {
  padding: 24px 10px;
  text-align: center;
  color: var(--cloud-muted);
  font-size: 12px;
}

.cloud-toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 3000;
  max-width: calc(100vw - 32px);
  padding: 10px 15px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 18px 40px -18px rgba(15, 23, 42, 0.7);
}

.cloud-toast-error {
  background: #b42318;
}

/* ---------- mobile ---------- */

@media (max-width: 680px) {
  .cloud-topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .cloud-brand {
    flex: 1;
  }

  .cloud-brand-text small {
    display: none;
  }

  .cloud-bar-actions {
    width: 100%;
  }

  .cloud-user-label {
    flex: 1;
    max-width: none;
    font-size: 10.5px;
  }

  .cloud-bar-actions .cloud-btn {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 6px 10px;
    font-size: 11.5px;
  }

  .cloud-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .cloud-modal {
    max-width: none;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
  }

  .cloud-modal-body {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .cloud-modal-actions {
    flex-direction: column-reverse;
  }

  .cloud-modal-actions .cloud-btn,
  .cloud-modal-actions .cloud-submit {
    width: 100%;
  }

  .cloud-saved-item {
    align-items: stretch;
  }

  .cloud-saved-delete {
    min-height: 40px;
  }
}

@media print {
  .cloud-topbar,
  .cloud-modal-backdrop,
  .cloud-toast {
    display: none !important;
  }
}
