/* ============================================
   PASTRYCAL HYBRID TOOLTIP SYSTEM
   Version 1.1
   Mobile-first, accessible tooltips
   ============================================ */

/* ======================== */
/* TOOLTIP CONTAINER & INPUTS */
/* ======================== */

/* Tooltip wrapper for inputs */
.tooltip-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  margin-bottom: 5px;
}

/* Adjust input padding to accommodate ? button */
.tooltip-wrapper input,
.tooltip-wrapper select {
  padding-right: 35px !important;
  width: 100%;
  box-sizing: border-box;
}

/* ======================== */
/* INFO BUTTON (?) - DESKTOP FIRST */
/* ======================== */

.info-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #8B4513;
  color: white;
  border: none;
  width: 24px;  /* Desktop size - largest */
  height: 24px; /* Desktop size - largest */
  border-radius: 50%;
  cursor: help;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  z-index: 10;
  transition: all 0.2s ease;
}

.info-btn:hover,
.info-btn:focus {
  background: #6B3410;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 2px 6px rgba(139, 69, 19, 0.3);
  outline: none;
}

.info-btn:active {
  transform: translateY(-50%) scale(0.95);
}

/* ======================== */
/* FLOATING TOOLTIP MODAL */
/* ======================== */

/* Overlay behind tooltip */
.tooltip-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  animation: overlayFadeIn 0.3s ease-out;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Tooltip modal */
.floating-tooltip {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #2c3e50;
  color: white;
  padding: 25px;
  border-radius: 12px;
  max-width: 320px;
  width: 90%;
  z-index: 10000;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  animation: tooltipFadeIn 0.3s ease-out;
  border: 2px solid #8B4513;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.floating-tooltip h4 {
  margin: 0 0 15px 0;
  color: #fff;
  font-size: 1.2em;
  font-weight: 600;
}

.floating-tooltip p {
  margin: 0 0 20px 0;
  font-size: 16px;
  line-height: 1.5;
  white-space: pre-line;
}

/* Tooltip close button */
.tooltip-close-btn {
  background: #8B4513;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  width: 100%;
  transition: background 0.2s ease;
}

.tooltip-close-btn:hover,
.tooltip-close-btn:focus {
  background: #6B3410;
  outline: none;
}

/* ======================== */
/* ACCESSIBILITY */
/* ======================== */

/* Screen Reader Only Text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for accessibility */
.info-btn:focus-visible {
  outline: 2px solid #D8B788;
  outline-offset: 2px;
}

.tooltip-close-btn:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* ======================== */
/* MOBILE ADAPTIVE STYLES */
/* Desktop -> Tablet -> Mobile -> Small Mobile */
/* ======================== */

/* Tablet - 1024px and below (smaller desktops/laptops) */
@media (max-width: 1024px) {
  /* Tablet can use the default 24px size or slightly smaller */
  /* No change needed, defaults are good for tablet */
}

/* Tablet Portrait - 768px and below */
@media (max-width: 768px) {
  .floating-tooltip {
    padding: 20px;
    max-width: 280px;
  }
  
  .floating-tooltip p {
    font-size: 15px;
  }
  
  .floating-tooltip h4 {
    font-size: 1.1em;
  }
  
  /* Tablet size - slightly smaller than desktop but larger than mobile */
  .info-btn {
    width: 22px;  /* Smaller than desktop (24px) but larger than mobile (20px) */
    height: 22px;
    font-size: 13px;
    right: 6px;
  }
  
  .tooltip-wrapper input,
  .tooltip-wrapper select {
    padding-right: 35px !important;
  }
}

/* Mobile - 480px and below */
@media (max-width: 480px) {
  .floating-tooltip {
    padding: 18px;
    max-width: 90%;
  }
  
  .floating-tooltip p {
    font-size: 14px;
    line-height: 1.4;
  }
  
  .floating-tooltip h4 {
    font-size: 1em;
    margin-bottom: 12px;
  }
  
  /* Mobile size - smaller than tablet */
  .info-btn {
    width: 20px;
    height: 20px;
    font-size: 12px;
    right: 5px;
  }
  
  /* Touch target for mobile */
  .info-btn::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
  }
  
  .tooltip-wrapper input,
  .tooltip-wrapper select {
    padding-right: 30px !important;
  }
}

/* Small Mobile - 360px and below */
@media (max-width: 360px) {
  .floating-tooltip {
    padding: 15px;
  }
  
  .floating-tooltip p {
    font-size: 13px;
  }
  
  .tooltip-close-btn {
    padding: 12px;
    font-size: 13px;
  }
  
  /* Smallest for very small screens */
  .info-btn {
    width: 18px;
    height: 18px;
    font-size: 11px;
    right: 4px;
  }
  
  .info-btn::after {
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
  }
  
  .tooltip-wrapper input,
  .tooltip-wrapper select {
    padding-right: 26px !important;
  }
}

/* ======================== */
/* DARK MODE SUPPORT */
/* ======================== */
@media (prefers-color-scheme: dark) {
  .floating-tooltip {
    background: #1a252f;
    border-color: #D8B788;
  }
  
  .tooltip-close-btn {
    background: #D8B788;
    color: #2c3e50;
  }
  
  .tooltip-close-btn:hover,
  .tooltip-close-btn:focus {
    background: #c9a87a;
  }
}

/* ======================== */
/* PRINT STYLES */
/* ======================== */
@media print {
  .info-btn,
  .tooltip-overlay,
  .floating-tooltip {
    display: none !important;
  }
  
  .tooltip-wrapper input,
  .tooltip-wrapper select {
    padding-right: 0 !important;
  }
}