/* Realtime API Voice Chat Styles */

.realtime-voice-chat-container {
    margin: 15px 0;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.voice-chat-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;  /* ⬅️ push ends apart */
  margin-bottom: 10px;
}

#realtime_voice_chat_container .voice-chat-hide-button {
  background: none;
  border: none;
  padding: 0;
  margin: 5px;
  margin-top: -4px;
  cursor: pointer;
  font-size: 14px;
  color: #555;
}

#realtime_voice_chat_container .voice-chat-hide-button:hover {
  color: #222;
}

.realtime-voice-btn,
.realtime-voice-btn-end {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.realtime-voice-btn {
    background: #28a745;
    color: white;
}

.realtime-voice-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

/* Disabled state */
#realtime_voice_chat_container .realtime-voice-btn.realtime-voice-btn-disabled,
#realtime_voice_chat_container .realtime-voice-btn:disabled {
  background-color: #c9c9c9;
  color: #555;
  cursor: not-allowed;
  opacity: 1;
  border-color: #bfbfbf;
  box-shadow: none;
}

/* Prevent hover animation on disabled voice buttons */
#realtime_voice_chat_container .realtime-voice-btn:disabled,
#realtime_voice_chat_container .realtime-voice-btn.realtime-voice-btn-disabled {
    transform: none;
    box-shadow: none;
}

#realtime_voice_chat_container .realtime-voice-btn:disabled:hover,
#realtime_voice_chat_container .realtime-voice-btn.realtime-voice-btn-disabled:hover {
    background-color: #c9c9c9; /* keep disabled background */
    color: #555;               /* keep readable text */
    transform: none;           /* override hover transform */
    box-shadow: none;          /* prevent hover shadow */
    cursor: not-allowed;
}


.realtime-voice-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.realtime-voice-btn-end {
    background: #dc3545;
    color: white;
    margin-left: 10px;
}

.realtime-voice-btn-end:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.voice-chat-status {
    display: flex;
    align-items: center;
    gap: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.voice-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    border: 1px solid #dee2e6;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: relative;
}

.status-dot.connecting {
    background: #ffc107;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.connected {
    background: #28a745;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.error {
    background: #dc3545;
}

.status-dot.disconnected {
    background: #6c757d;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 currentColor;
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 0 8px transparent;
        opacity: 0.5;
    }
}

.status-text {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.voice-chat-instructions {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
        padding-top: 15px;
        padding-bottom: 15px;
    }
}

.voice-chat-instructions h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #007bff;
}

.voice-chat-instructions p {
    margin: 8px 0;
    color: #495057;
    line-height: 1.6;
}

.voice-chat-instructions ul {
    margin: 10px 0;
    padding-left: 25px;
}

.voice-chat-instructions li {
    margin: 5px 0;
    color: #6c757d;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .realtime-voice-chat-container {
        padding: 5px;
    }

    .realtime-voice-btn,
    .realtime-voice-btn-end {
        font-size: 14px;
        padding: 8px 16px;
    }

    .voice-chat-status {
        flex-direction: column;
        align-items: flex-start;
    }

    .realtime-voice-btn-end {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

/* Integration with existing chat UI */
#chat_message_autocomplete_wrapper.hidden-for-voice,
#write_chat_container.hidden-for-voice {
    display: none !important;
}

/* Loading state */
.realtime-voice-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.realtime-voice-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
/* Ensure the tooltip isn't clipped by its containers */
.realtime-voice-chat-container,
.voice-chat-controls-row,
.voice-chat-start-wrapper {
  overflow: visible;
}

/* The info trigger */
.voice-chat-start-wrapper #use_voice_info {
  position: relative;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  cursor: default;
}

.voice-chat-start-wrapper #use_voice_info:after {
  content: "\f14c";
  font-family: "dashicons";
  font-size: 16px;
  opacity: 0.85;
}

/* Tooltip itself */
.voice-chat-start-wrapper #use_voice_info .info_modal {
  display: none;
  position: absolute;

  /* OPEN UPWARDS */
  bottom: calc(100% + 10px);  /* place above icon */
  left: 0;

  z-index: 999999;

  background: #fff;
  padding: 12px;
  border: 1px solid #162c47;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);

  /* Make it large enough for long content */
  width: 420px;
  max-width: min(520px, 90vw);

  /* Limit height so it doesn't cover the whole screen */
  max-height: 320px;
  overflow: auto;

  white-space: normal;
}

/* Show on hover */
.voice-chat-start-wrapper #use_voice_info:hover .info_modal {
  display: block;
}

/* Optional: tidy list spacing inside the tooltip */
.voice-chat-start-wrapper #use_voice_info .info_modal ul {
  margin: 0.5em 0 1em;
  padding-left: 1.2em;
}

.voice-chat-start-wrapper #use_voice_info .info_modal li {
  list-style: disc;
  margin: 0.25em 0;
}
