/**
 * LAWO-Spotlight Frontend Styles
 *
 * @package LAWO_Spotlight
 */

/* Variables */
:root {
  --lawo-spotlight-card-size: 45px;
  --lawo-spotlight-card-gap: 5px;
  --lawo-spotlight-transition-speed: 0.25s;
  --lawo-spotlight-label-width: 150px;
  --lawo-spotlight-z-index: 99999;
}

/* Container - Desktop (Fixed Right Sidebar) */
.lawo-spotlight-container {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--lawo-spotlight-card-gap);
  z-index: var(--lawo-spotlight-z-index);
  padding: 10px;
}

/* Individual Card */
.lawo-spotlight-card {
  position: relative;
  width: var(--lawo-spotlight-card-size);
  height: var(--lawo-spotlight-card-size);
  border-radius: 3px;
  cursor: pointer;
  overflow: visible;
  transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  /* Colored background from --card-color */
  background-color: var(--card-color, #666);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lawo-spotlight-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Hover bridge - unsichtbare Erweiterung nach links zum Label */
.lawo-spotlight-card::after {
  content: "";
  position: absolute;
  left: -20px;
  top: -10px;
  bottom: -10px;
  width: 20px;
}

/* Link card specific */
.lawo-spotlight-link-card {
  color: inherit;
}

/* Card Icon */
.lawo-spotlight-card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lawo-spotlight-card-icon lottie-player {
  width: 100%;
  height: 100%;
}

/* Dark Icon Theme - makes white icons black */
.lawo-spotlight-card-icon.icon-theme-dark lottie-player {
  filter: brightness(0);
}

/* Card Label - Glassmorphism style */
.lawo-spotlight-card-label {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0 14px 0 18px;
  height: var(--lawo-spotlight-card-size);
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%) translateX(12px) scale(0.95);
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
  pointer-events: none;
  overflow: hidden;
  /* Vertical centering */
  display: flex;
  align-items: center;
}

/* Farbige Linie links (Card-Farbe) */
.lawo-spotlight-card-label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--card-color);
  border-radius: 3px 0 0 3px;
}

.lawo-spotlight-card:hover .lawo-spotlight-card-label,
.lawo-spotlight-card-label:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
}

/* Label Text - dunkel für Glassmorphism */
.lawo-spotlight-label-text {
  color: #1a1a2e;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

/* Loading State */
.lawo-spotlight-card-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: inherit;
  border-radius: inherit;
  z-index: 2;
}

.lawo-spotlight-login-card.is-loading .lawo-spotlight-card-loading {
  display: flex;
}

.lawo-spotlight-login-card.is-loading .lawo-spotlight-card-icon {
  opacity: 0;
}

/* Auth Check State - no hover effects while checking */
.lawo-spotlight-login-card.is-checking:hover .lawo-spotlight-card-label,
.lawo-spotlight-login-card.is-checking:hover .lawo-spotlight-user-panel {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Spinner (Lottie) */
.lawo-spotlight-spinner {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

/* User Panel - Glassmorphism style */
.lawo-spotlight-user-panel {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 14px 18px 14px 22px;
  border-radius: 3px;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%) translateX(12px) scale(0.95);
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.05);
  pointer-events: none;
  display: none;
  overflow: hidden;
}

/* Farbige Linie links (Card-Farbe) */
.lawo-spotlight-user-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--card-color);
  border-radius: 3px 0 0 3px;
}

.lawo-spotlight-login-card.is-logged-in .lawo-spotlight-user-panel {
  display: block;
}

.lawo-spotlight-login-card.is-logged-in:hover .lawo-spotlight-user-panel,
.lawo-spotlight-user-panel:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
}

.lawo-spotlight-login-card.is-logged-in:hover .lawo-spotlight-card-label {
  display: none;
}

/* Permanently open user panel (click state) */
.lawo-spotlight-login-card.is-logged-in.is-panel-open
  .lawo-spotlight-user-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
}

.lawo-spotlight-login-card.is-logged-in.is-panel-open
  .lawo-spotlight-card-label {
  display: none;
}

.lawo-spotlight-user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

/* User Info - dunkler Text für Glassmorphism */
.lawo-spotlight-user-name {
  color: #1a1a2e;
  font-size: 14px;
  font-weight: 600;
}

.lawo-spotlight-user-email {
  color: #666;
  font-size: 12px;
  white-space: nowrap;
}

.lawo-spotlight-user-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.lawo-spotlight-user-settings,
.lawo-spotlight-user-logout {
  display: inline-flex;
  align-items: center;
  color: #1a1a2e;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 3px;
  background-color: rgba(0, 0, 0, 0.04);
  transition: background-color 0.15s ease;
}

.lawo-spotlight-user-settings:hover,
.lawo-spotlight-user-logout:hover {
  background-color: rgba(0, 0, 0, 0.06);
  color: #1a1a2e;
}

/* Mobile - Bottom Navigation */
@media screen and (max-width: 400px) {
  .lawo-spotlight-container {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    top: auto;
    transform: none;
    flex-direction: row;
    justify-content: center;
    background: var(--lawo-mobile-bar-color, #1a1a2e);
    padding: 12px 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    gap: 2em;
  }

  .lawo-spotlight-card {
    width: 44px;
    height: 44px;
    background: transparent !important;
    box-shadow: none;
  }

  .lawo-spotlight-card:hover {
    box-shadow: none;
  }

  /* Disable hover bridge on mobile */
  .lawo-spotlight-card::after {
    display: none;
  }

  .lawo-spotlight-card-icon {
    width: 36px;
    height: 36px;
  }

  /* Hide labels on mobile */
  .lawo-spotlight-card-label {
    display: none !important;
  }

  /* Hide user panel on mobile (replaced by modal) */
  .lawo-spotlight-user-panel {
    display: none !important;
  }
}

/* Prevent flash of unstyled content */
.lawo-spotlight-container:not(.is-initialized) {
  opacity: 0;
}

.lawo-spotlight-container.is-initialized {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Add body class when spotlight is active */
body.lawo-spotlight-active {
  /* Prevents content from being hidden behind mobile nav */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .lawo-spotlight-card-label,
  .lawo-spotlight-user-panel {
    border: 1px solid rgba(0, 0, 0, 0.2);
  }
}

/* Print styles - hide spotlight */
@media print {
  .lawo-spotlight-container {
    display: none !important;
  }
}

/* =============================================
   User Modal (Mobile)
   ============================================= */
.lawo-spotlight-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lawo-spotlight-modal.is-open {
  display: flex;
}

.lawo-spotlight-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lawo-spotlight-modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px 24px;
  min-width: 280px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: lawoModalSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes lawoModalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lawo-spotlight-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.lawo-spotlight-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.lawo-spotlight-modal-user-info {
  text-align: center;
  margin-bottom: 24px;
  padding-top: 8px;
}

.lawo-spotlight-modal-user-name {
  display: block;
  font-size: 20px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.lawo-spotlight-modal-user-email {
  display: block;
  font-size: 14px;
  color: #666;
}

.lawo-spotlight-modal-actions {
  display: flex;
  gap: 12px;
}

.lawo-spotlight-modal-actions a {
  flex: 1;
  text-align: center;
  padding: 14px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.lawo-spotlight-modal-actions a:active {
  transform: scale(0.98);
}

.lawo-spotlight-modal-settings {
  background: #f0f0f0;
  color: #1a1a2e;
}

.lawo-spotlight-modal-settings:hover {
  background: #e5e5e5;
  color: #1a1a2e;
}

.lawo-spotlight-modal-logout {
  background: #e6007e;
  color: #fff;
}

.lawo-spotlight-modal-logout:hover {
  background: #cc006e;
  color: #fff;
}
