/* ════════════════════════════════════════════════════════════════════
   VOGEL G9 APP SUITE - COMMON STYLES
   Consolidated styling for security, loaders, and notifications
   ════════════════════════════════════════════════════════════════════ */

/* ── SLEEK PASSWORD ENTRY VIEW ── */
#view-pin {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 40px;
  min-height: 70vh;
  width: 100%;
}
#view-pin.active {
  display: flex;
  animation: viewPinFadeIn 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes viewPinFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

#pin-lock {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-dim, rgba(22, 163, 74, 0.05));
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-lt, var(--accent));
  margin-bottom: 24px;
  box-shadow: 0 0 25px rgba(var(--accent-rgb, 22, 163, 74), 0.15);
  animation: pulseLock 2s infinite ease-in-out;
}

@keyframes pulseLock {
  0% { transform: scale(1); box-shadow: 0 0 20px rgba(var(--accent-rgb, 22, 163, 74), 0.15); }
  50% { transform: scale(1.03); box-shadow: 0 0 30px rgba(var(--accent-rgb, 22, 163, 74), 0.3); }
  100% { transform: scale(1); box-shadow: 0 0 20px rgba(var(--accent-rgb, 22, 163, 74), 0.15); }
}

#pin-heading {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 30px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#password-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 300px;
}

#pin-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border2, #1a3220);
  color: var(--text);
  font-size: 16px;
  outline: none;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

#pin-input:focus {
  border-color: var(--accent-lt, var(--accent));
  background: rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 
              0 0 16px rgba(var(--accent-rgb, 22, 163, 74), 0.25);
}

#pin-submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2, var(--accent)));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(var(--accent-rgb, 22, 163, 74), 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#pin-submit-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(var(--accent-rgb, 22, 163, 74), 0.4);
}

#pin-submit-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb, 22, 163, 74), 0.2);
}

#pin-error {
  color: var(--danger, #ef4444);
  font-size: 12px;
  font-weight: 600;
  margin-top: 16px;
  letter-spacing: 0.08em;
  display: none;
  animation: shakeError 0.35s ease-in-out;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ── STRETCHING TOASTS ── */
#toast {
  position: fixed;
  bottom: max(32px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  background: rgba(14, 26, 16, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 12px 24px;
  font-size: 13.5px;
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  z-index: 1100;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5),
              0 0 1px rgba(255, 255, 255, 0.1) inset;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
#toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ── CENTRAL CONFIRM MODAL ── */
#swiftwing-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

#swiftwing-confirm-overlay.show {
  opacity: 1;
  visibility: visible;
}

#swiftwing-confirm-box {
  background: radial-gradient(ellipse at top, rgba(30, 41, 67, 0.98), rgba(12, 17, 30, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  max-width: 400px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.2) inset;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

#swiftwing-confirm-overlay.show #swiftwing-confirm-box {
  transform: scale(1) translateY(0);
}

#swiftwing-confirm-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

#swiftwing-confirm-msg {
  font-size: 14px;
  color: var(--muted, #94a3b8);
  line-height: 1.5;
  margin-bottom: 22px;
}

#swiftwing-confirm-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.swiftwing-confirm-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
}

.swiftwing-confirm-btn:active {
  transform: scale(0.97);
}

.swiftwing-confirm-btn.cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.swiftwing-confirm-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.swiftwing-confirm-btn.primary {
  background: linear-gradient(135deg, var(--accent, #38bdf8), var(--accent2, var(--accent, #0284c7)));
  color: #fff;
  box-shadow: 0 4px 14px rgba(var(--accent-rgb, 56, 189, 248), 0.3);
}

.swiftwing-confirm-btn.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

/* ── Muted-text override in disabled states ── */
.btn-add:disabled {
  opacity: 0.45;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

/* Hide fallback numpads just in case HTML contains leftover nodes */
#numpad, #pin-dots {
  display: none !important;
}

/* ════════════════════════════════════════════════════════════════════
   UNIFIED SWIFTWING HUB BUTTON (STANDARD COMPONENT)
   ════════════════════════════════════════════════════════════════════ */
.swiftwing-hub-btn,
#topbar-hub-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-muted, var(--muted, #94a3b8));
  text-decoration: none;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

.swiftwing-hub-btn .swiftwing-hub-icon,
#topbar-hub-link .swiftwing-hub-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.swiftwing-hub-btn:hover,
#topbar-hub-link:hover {
  color: #38bdf8 !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  background: rgba(56, 189, 248, 0.1) !important;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.22) !important;
}

.swiftwing-hub-btn:hover .swiftwing-hub-icon,
#topbar-hub-link:hover .swiftwing-hub-icon {
  transform: scale(1.08);
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.5));
}

.swiftwing-hub-btn:active,
#topbar-hub-link:active {
  transform: scale(0.95);
  background: rgba(56, 189, 248, 0.16) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
  color: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3) !important;
}

/* Responsive: Mobile (<768px) = Compact 32x32px square icon, Desktop (>=768px) = Icon + Text */
@media (max-width: 767px) {
  .swiftwing-hub-btn,
  #topbar-hub-link {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 9px;
  }
  .swiftwing-hub-btn .swiftwing-hub-text,
  #topbar-hub-link .swiftwing-hub-text {
    display: none;
  }
  .swiftwing-hub-btn .swiftwing-hub-icon,
  #topbar-hub-link .swiftwing-hub-icon {
    width: 16px;
    height: 16px;
  }
}

/* Special positioning for Hausbau (which lacks a standard topbar) */
.hausbau-hub-btn {
  position: absolute;
  top: max(20px, calc(14px + env(safe-area-inset-top, 0px)));
  right: max(16px, calc((100% - 900px) / 2 + 16px));
  z-index: 99;
}


