/* Interactive Poster Styles */

/* Base Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 59, 92, 0.5);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #f0e8f5;
    border-radius: 20px;
    padding: 1.5rem 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(74, 59, 92, 0.3);
}

.modal-image-container {
    position: relative;
    max-width: 400px;
    width: 90%;
    margin: 0 auto;
}

.modal-image {
    width: 100%;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(74, 59, 92, 0.4);
}

.poster-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.poster-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Hotspot styling - invisible clickable areas */
.hotspot {
    position: absolute;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01); /* Nearly invisible */
    border-radius: 50%; /* Circular hotspots for faces */
    transition: background 0.2s;
}

.hotspot:hover {
    background: rgba(255, 255, 255, 0.15); /* Slight highlight on hover */
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Position hotspots as percentages of container for responsiveness */
/* These positions assume a 2x2 grid layout */

/* Guides1 hotspots */
.shopping-hotspot {
    top: 15%;
    left: 10%;
    width: 35%;
    height: 30%;
}

.family-hotspot {
    top: 15%;
    right: 10%;
    width: 35%;
    height: 30%;
}

.restaurant-hotspot {
    bottom: 25%;
    left: 10%;
    width: 35%;
    height: 30%;
}

.friend-hotspot {
    bottom: 25%;
    right: 10%;
    width: 35%;
    height: 30%;
}

/* Guides2 hotspots */
.food-hotspot {
    top: 15%;
    left: 10%;
    width: 35%;
    height: 30%;
}

.sleep-hotspot {
    top: 15%;
    right: 10%;
    width: 35%;
    height: 30%;
}

.finance-hotspot {
    bottom: 25%;
    left: 10%;
    width: 35%;
    height: 30%;
}

.memory-hotspot {
    bottom: 25%;
    right: 10%;
    width: 35%;
    height: 30%;
}

/* Guides3 hotspots */
.medical-hotspot {
    top: 15%;
    left: 10%;
    width: 35%;
    height: 30%;
}

.chef-hotspot {
    top: 15%;
    right: 10%;
    width: 35%;
    height: 30%;
}

.spiritual-hotspot {
    bottom: 25%;
    left: 10%;
    width: 35%;
    height: 30%;
}

.gardener-hotspot {
    bottom: 25%;
    right: 10%;
    width: 35%;
    height: 30%;
}

/* Button hotspots - positioned over the bottom buttons */
.btn-speak-hotspot {
    bottom: 2%;
    left: 5%;
    width: 28%;
    height: 8%;
    border-radius: 25px;
}

.btn-type-hotspot {
    bottom: 2%;
    left: 36%;
    width: 28%;
    height: 8%;
    border-radius: 25px;
}

.btn-more-hotspot {
    bottom: 2%;
    right: 5%;
    width: 28%;
    height: 8%;
    border-radius: 25px;
}

/* Homepage (index.html) - button hotspots */
.btn-type-hotspot {
    top: 81.0%;
    left: 36.9%;
    width: 27.9%;
    height: 4.9%;
    border-radius: 25px;
}

/* Speak Now Hotspot - positioned over Speak Now button */
.btn-speak-hotspot {
    top: 81.0%;
    left: 5%;
    width: 28%;
    height: 4.9%;
    border-radius: 25px;
    z-index: 5;
}

/* More Subjects Hotspot - homepage positioning */
.btn-more-hotspot {
    top: 81.0%;
    right: 5%;
    width: 28%;
    height: 4.9%;
    border-radius: 25px;
    z-index: 5;
}

/* Guide Page - Poster Style Container */
.guide-poster-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: linear-gradient(180deg, #f5f0f8 0%, #e8e0f0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 85px; /* Space for bottom buttons */
}

/* Guide Header - avatar on left, name/tagline on right */
.guide-poster-container .guide-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: linear-gradient(180deg, #d4c5e0 0%, #f5f0f8 100%);
    width: 100%;
    gap: 12px;
}

.guide-poster-container .guide-avatar-oval {
    width: 100px;
    height: 125px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid white;
    box-shadow: 0 4px 20px rgba(74, 59, 92, 0.3);
    flex-shrink: 0;
}

.guide-poster-container .guide-avatar-oval img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.guide-poster-container .guide-header-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

.guide-poster-container .guide-header h1 {
    font-size: 26px;
    color: #4a3b5c;
    margin-bottom: 5px;
    font-weight: 600;
}

.guide-poster-container .guide-title {
    font-size: 15px;
    color: #6b5b7d;
    font-style: italic;
}

/* Compact Header - avatar and text centered together */
.guide-header-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    background: linear-gradient(180deg, #d4c5e0 0%, #f5f0f8 100%);
    width: 100%;
    gap: 10px;
}

.guide-avatar-oval-compact {
    width: 90px;
    height: 110px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(74, 59, 92, 0.3);
    flex-shrink: 0;
}

.guide-avatar-oval-compact img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.guide-header-text-compact {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.guide-header-text-compact h1 {
    font-size: 24px;
    color: #4a3b5c;
    margin: 0 0 3px 0;
    font-weight: 600;
    line-height: 1.2;
}

.guide-header-text-compact .guide-title {
    font-size: 14px;
    color: #6b5b7d;
    font-style: italic;
    margin: 0;
    line-height: 1.2;
}

/* Guide Chat Stream Box - extends to buttons with bump at top */
.guide-chat-stream-box {
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translateX(-50%);
    width: 88%;
    height: 58%;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(74, 59, 92, 0.15);
    padding: 20px;
    overflow-y: auto;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 15px;
    line-height: 1.6;
    color: #4a3b5c;
    z-index: 5;
}

/* Wider Chat Stream Box - matches buttons image width */
/* NOTE: Height is controlled by top/bottom positioning, not height property */
/* This avoids conflicts with external CSS that sets height: 45% */
.guide-chat-stream-box-wide {
    position: absolute;
    top: 20%;
    bottom: 85px; /* Default: stop above buttons */
    left: 50%;
    transform: translateX(-50%);
    width: 96%;
    /* No height here - controlled by bottom positioning */
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(74, 59, 92, 0.15);
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain; /* Prevent scroll chaining/pulling past bounds */
    -webkit-overflow-scrolling: auto; /* Consistent scrolling on iOS */
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: #4a3b5c;
    z-index: 5;
}

/* Voice mode: extend almost to bottom buttons (80px space) */
.guide-chat-stream-box-wide.voice-mode,
.guide-chat-stream-box-wide.voice-active {
    bottom: 85px !important;
    height: auto !important;
    max-height: none !important;
}

/* TypeNow mode: stop closer to keyboard - but ensure scrollable */
.guide-chat-stream-box-wide.type-now-active,
.guide-chat-stream-box-wide.keyboard-mode {
    bottom: 280px !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
}

/* Ensure the container creates stacking context for triangle */
.guide-poster-container {
    position: relative;
    z-index: 1;
}

/* The "bump" at the top of the chat box - indicates Guide is speaking */
.guide-chat-stream-box::before,
.guide-chat-stream-box-wide::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    margin-left: -12px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid #ffffff;
    z-index: 100;
}

/* Guide text - continuous paragraphs on white background */
.guide-chat-stream-box p {
    margin-bottom: 12px;
    text-align: left;
}

.guide-chat-stream-box p:last-child {
    margin-bottom: 0;
}

/* User messages (when typing) */
.user-message {
    background: #007aff;
    color: white;
    padding: 10px 14px;
    border-radius: 16px;
    margin-bottom: 10px;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    max-width: 85%;
}

/* Guide page button hotspots - ABSOLUTE POSITIONS within container (like index.html) */
.guide-poster-container a.hotspot.btn-speak-hotspot,
.guide-poster-container a.hotspot.btn-type-hotspot,
.guide-poster-container a.hotspot.btn-done-hotspot {
    position: absolute !important;
    width: 28% !important;
    height: 8% !important;
    border-radius: 25px;
    z-index: 100;
    display: block;
    cursor: pointer;
    background: rgba(255, 0, 0, 0.3) !important;
    border: 2px solid red !important;
}

.guide-poster-container a.hotspot.btn-speak-hotspot {
    bottom: 2% !important;
    left: 5% !important;
}

.guide-poster-container a.hotspot.btn-type-hotspot {
    bottom: 2% !important;
    left: 36% !important;
}

.guide-poster-container a.hotspot.btn-done-hotspot {
    bottom: 2% !important;
    right: 5% !important;
}

/* Bottom buttons background image - FIXED at 2% from bottom of viewport, in front of chat */
.guide-bottom-buttons {
    position: fixed;
    bottom: 2%;
    left: 50%;
    transform: translateX(-50%);
    width: 96%;
    max-width: 576px;
    height: auto;
    z-index: 1000;
    pointer-events: none;
}

/* Embedded Keyboard - above the buttons, matches chat box width */
.embedded-keyboard {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    width: 96%;
    background: #d1d5db;
    padding: 8px 5px;
    border-top: 1px solid #b0b4b8;
    border-radius: 12px 12px 0 0;
    z-index: 10;
    display: none;
}

.embedded-keyboard .visual-keyboard {
    background: transparent;
    max-width: 600px;
    margin: 0 auto;
}

.embedded-keyboard .keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 5px;
}

.embedded-keyboard .keyboard-row:last-child {
    margin-bottom: 0;
}

.embedded-keyboard .key-cap {
    background: white;
    border-radius: 5px;
    min-width: 28px;
    height: 39px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 500;
    color: #333;
    box-shadow: 0 2px 0 #999;
    cursor: pointer;
    user-select: none;
    flex: 1;
    max-width: 45px;
}

.embedded-keyboard .key-cap:active {
    background: #e0e0e0;
    transform: translateY(2px);
    box-shadow: 0 0 0 #999;
}

.embedded-keyboard .key-cap.wide {
    max-width: 55px;
}

.embedded-keyboard .key-cap.space {
    max-width: none;
    flex: 3;
}

.embedded-keyboard .key-cap.gray {
    background: #aeb3b9;
    color: #333;
}

.embedded-keyboard .key-cap.enter-key {
    background: #007aff;
    color: white;
    max-width: 68px;
    font-size: 20px;
    flex: 1.5;
}

/* Keyboard Modal - positioned at bottom of display, no dimming */
.keyboard-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    pointer-events: none;
}

.keyboard-modal.show {
    display: flex;
    pointer-events: auto;
}

.keyboard-modal-content {
    background: #d1d5db;
    border-radius: 16px 16px 0 0;
    padding: 8px 8px 4px 8px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 0 auto;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    transform: scale(0.88);
    transform-origin: bottom center;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scale(0.88);
}

/* Smaller keyboard keys within modal */
.keyboard-modal-content .visual-keyboard {
    background: transparent;
    padding: 0;
}

.keyboard-modal-content .keyboard-row {
    gap: 4px;
    margin-bottom: 5px;
}

.keyboard-modal-content .key-cap {
    min-width: 26px;
    height: 36px;
    font-size: 16px;
    border-radius: 5px;
}

.keyboard-modal-content .key-cap.space {
    min-width: 150px;
}

/* Scrollbar styling for guide chat */
.guide-chat-stream-box::-webkit-scrollbar {
    width: 6px;
}

.guide-chat-stream-box::-webkit-scrollbar-track {
    background: #f0e8f5;
    border-radius: 3px;
}

.guide-chat-stream-box::-webkit-scrollbar-thumb {
    background: #9b7cb6;
    border-radius: 3px;
}

/* Speak Now Modal - semi-transparent background */
.modal.speak-modal {
    display: none;
    background: rgba(74, 59, 92, 0.8) !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

.modal.speak-modal.show {
    display: flex !important;
}

.speak-modal .modal-content {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(74, 59, 92, 0.4);
}

.speak-modal h3 {
    color: #4a3b5c;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    font-family: Georgia, 'Times New Roman', serif;
}

.speak-modal p {
    color: #6b5b7d;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.mic-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.recording-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.recording-indicator.active {
    display: flex;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.recording-text {
    color: #e74c3c;
    font-weight: bold;
}

/* Chat Stream Box - full width matching both character boxes */
.chat-stream-box {
    position: absolute;
    top: 32%; height: 54%;
    left: 50%;
    transform: translateX(-50%);
    width: 88%;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(74, 59, 92, 0.15);
    padding: 16px 20px;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: #4a3b5c;
    z-index: 10;
}

/* Static text display with paragraph breaks */
.static-text {
    text-align: left;
}

.static-text p {
    margin: 0 0 12px 0;
}

.static-text p:last-child {
    margin-bottom: 0;
}

/* Steve Box Hotspot - covers Steve's character box area */
.steve-box-hotspot {
    position: absolute;
    top: 8%;
    left: 5%;
    width: 42%;
    height: 32%;
    border-radius: 16px;
    z-index: 5;
}

/* Stevie Box Hotspot - covers Stevie's character box area */
.stevie-box-hotspot {
    position: absolute;
    top: 8%;
    right: 5%;
    width: 42%;
    height: 32%;
    border-radius: 16px;
    z-index: 5;
}

/* Chat message styling */
.chat-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 85%;
}

.chat-message.steve {
    background: #f0e8f5;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.chat-message.stevie {
    background: #e8f0f5;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    text-align: right;
}

/* Scrollbar styling */
.chat-stream-box::-webkit-scrollbar {
    width: 6px;
}

.chat-stream-box::-webkit-scrollbar-track {
    background: #f0e8f5;
    border-radius: 3px;
}

.chat-stream-box::-webkit-scrollbar-thumb {
    background: #9b7cb6;
    border-radius: 3px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Bottom buttons overlay */
.poster-buttons {
    position: absolute;
    bottom: 2%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 2%;
    padding: 0 5%;
}

.btn-poster,
.btn-poster-link {
    flex: 1;
    max-width: 140px;
    padding: 12px 8px;
    font-size: 0.9rem;
    text-align: center;
    border: 2px solid #fff;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.9);
    color: #4a3b5c;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-poster:hover,
.btn-poster-link:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .btn-poster,
    .btn-poster-link {
        font-size: 0.8rem;
        padding: 10px 6px;
        max-width: 100px;
    }
    
    .poster-buttons {
        gap: 1%;
    }
}

/* Modal adjustments for poster */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 59, 92, 0.7);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #f0e8f5;
    border-radius: 20px;
    padding: 1.5rem 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(74, 59, 92, 0.4);
}

.modal-content p {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.modal-prompt {
    font-size: 1rem;
    color: #6b5b7d;
    margin: 1.5rem 0 0.5rem;
    font-style: italic;
}

.btn-modal {
    display: inline-block;
    background: #d4c5e0;
    color: #4a3b5c;
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(74, 59, 92, 0.2);
    text-decoration: none;
}

.btn-modal:hover {
    background: #c5b5d5;
}

/* Modal image styling */
.modal-image-container {
    position: relative;
    max-width: 400px;
    width: 90%;
    margin: 0 auto;
}

.modal-image {
    width: 100%;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(74, 59, 92, 0.4);
}

/* Hotspot over the More Subjects button in the modal */
.modal-button-hotspot {
    position: absolute;
    bottom: 8%;
    left: 10%;
    width: 80%;
    height: 18%;
    border-radius: 25px;
    cursor: pointer;
}

/* Hotspots container - flexbox layout */
#hotspots-container {
    position: absolute;
    bottom: 50px;
    left: -5%;
    width: 110%;
    height: 66px;
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: flex-start;
    z-index: 100;
    padding: 0 10px;
    box-sizing: border-box;
}

#hotspots-container .hotspot {
    width: 32%;
    height: 80px;
    min-height: 80px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    box-sizing: border-box;
    cursor: pointer;
}

#hotspots-container .hotspot:hover {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Hotspot visibility overrides - must use !important to override .guide-poster-container rules */
#hotspots-container .hotspot.btn-speak-hotspot,
#hotspots-container .hotspot.btn-type-hotspot,
#hotspots-container .hotspot.btn-done-hotspot {
    background: rgba(255, 255, 255, 0.01) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Speak Now - another 10% taller, bottom reference preserved */
#hotspots-container .hotspot.btn-speak-hotspot {
    margin-top: -19px;
    margin-left: 1%;
}

/* Type Instead - another 10% taller, bottom reference preserved */
#hotspots-container .hotspot.btn-type-hotspot {
    margin-top: -20px;
}

/* Done - down 60% of height and left 1% using transform */
#hotspots-container .hotspot.btn-done-hotspot {
    transform: translateY(48px) translateX(-1%);
}
