/**
 * SAEZ Crane Mascot — Styles
 * Comic-style speech bubbles + settings panel + realistic crane animations
 * SAEZ corporate: white (#F5F5F0) + red (#CC0000)
 */

/* ─── Main Container ──────────────────────────────────── */

#saez-crane-mascot {
  position: fixed;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

/* ─── Speech Bubble (Comic Style) ─────────────────────── */

.crane-mascot-bubble {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  min-width: 150px;
  max-width: 280px;
  padding: 10px 14px;
  background: #fff;
  border: 2px solid #CC0000;
  border-radius: 12px;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: #333;
  box-shadow: 2px 3px 0 #990000;
  pointer-events: none;
  animation: bubblePop 0.3s ease-out;
  z-index: 100000;
  word-wrap: break-word;
}

/* Bubble tail (triangle) pointing down-left */
.crane-mascot-bubble::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid #fff;
  filter: drop-shadow(1px 2px 0 #990000);
}
.crane-mascot-bubble::before {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 18px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid #CC0000;
}

/* Bubble tail right variant */
.crane-mascot-bubble.bubble-right::after {
  left: auto;
  right: 20px;
}
.crane-mascot-bubble.bubble-right::before {
  left: auto;
  right: 18px;
}

/* Pop-in animation */
@keyframes bubblePop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ─── Settings Panel ──────────────────────────────────── */

.crane-mascot-settings {
  animation: settingsSlide 0.2s ease-out;
}

@keyframes settingsSlide {
  0% {
    transform: translateY(10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.crane-mascot-settings select {
  outline: none;
}
.crane-mascot-settings select:focus {
  border-color: #CC0000;
}

.crane-mascot-settings input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  outline: none;
}
.crane-mascot-settings input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #CC0000;
  border: 2px solid #333;
  border-radius: 50%;
  cursor: pointer;
}

.crane-mascot-settings button:hover {
  filter: brightness(1.1);
}

/* ─── Settings Gear Button ────────────────────────────── */

.crane-mascot-settings-btn:hover {
  background: #CC0000 !important;
  color: #fff !important;
  transform: rotate(90deg);
  transition: transform 0.3s, background 0.2s, color 0.2s !important;
}

/* ─── SVG Animation ──────────────────────────────────── */
/* All crane movement is smoothed via JS lerp at 60fps.
   No CSS transitions on SVG elements — prevents desync. */

/* Subtle idle breathing on cabin */
@keyframes craneIdle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.5px); }
}

#crane-cabin {
  animation: craneIdle 4s ease-in-out infinite;
}

/* ─── Z-Z-Z Animation for Sleep ───────────────────────── */

@keyframes zzz {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-20px) scale(1.3);
    opacity: 0;
  }
}

/* ─── Dark Mode ───────────────────────────────────────── */

[data-theme="dark"] .crane-mascot-bubble {
  background: var(--app-card-bg, #1e293b);
  color: var(--app-text, #e2e8f0);
  box-shadow: 2px 3px 0 #660000;
}
[data-theme="dark"] .crane-mascot-bubble::after {
  border-top-color: var(--app-card-bg, #1e293b);
}
[data-theme="dark"] .crane-mascot-settings {
  background: var(--app-card-bg, #1e293b) !important;
  color: var(--app-text, #e2e8f0) !important;
  border-color: #CC0000 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
[data-theme="dark"] .crane-mascot-settings input[type="range"] {
  background: var(--app-border, #334155);
}
[data-theme="dark"] .crane-mascot-settings-btn {
  background: var(--app-card-bg, #1e293b) !important;
  color: var(--app-text, #e2e8f0) !important;
  border-color: var(--app-border, #334155) !important;
}

/* ─── Responsive ──────────────────────────────────────── */

@media (max-width: 768px) {
  .crane-mascot-bubble {
    max-width: 180px;
    font-size: 11px;
    padding: 8px 10px;
  }
  .crane-mascot-settings {
    width: 180px !important;
    font-size: 11px !important;
  }
}
