/*---------------------------------------------------*/
/*	SPEECH BUBBLE / DIALOG STYLES
/*---------------------------------------------------*/

/* Ensure parent containers don't clip the tails */
.tokyo_tm_modalbox .main_content .descriptions {
    overflow: visible;
}

/* Ensure proper spacing after quotebox and other elements before speech bubbles */
.tokyo_tm_modalbox .main_content .descriptions .quotebox {
    margin-bottom: 24px;
}

.tokyo_tm_modalbox .main_content .descriptions .quotebox + .speech-bubble-left,
.tokyo_tm_modalbox .main_content .descriptions .quotebox + .speech-bubble-right,
.tokyo_tm_modalbox .main_content .descriptions p + .speech-bubble-left,
.tokyo_tm_modalbox .main_content .descriptions p + .speech-bubble-right {
    margin-top: 22px !important;
    clear: both;
}

/* Base speech bubble class */
.speech-bubble {
    position: relative;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 8px 10px;
    margin: 5px 0;
    display: inline-block;
    max-width: 100%;
}

/* Speech bubble with tail pointing left */
.speech-bubble-left {
    position: relative;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 20px 20px !important;
    margin-top: 22px;
    margin-bottom: 22px;
    margin-left: 20px; /* Space for the tail */
    margin-right: 10%;
    display: block;
    max-width: calc(100% - 40px);
    width: fit-content;
    clear: both;
}

/* Outer tail pointing left */
.speech-bubble-left::after {
    content: '';
    position: absolute;
    top: 20px;
    left: -15px;
    width: 0;
    height: 0;
    border: 15px solid transparent;
    border-right-color: #333;
    border-left: none;
    z-index: 1;
}

/* Inner tail pointing left (matches background) */
.speech-bubble-left::before {
    content: '';
    position: absolute;
    top: 22px;
    left: -12px;
    width: 0;
    height: 0;
    border: 13px solid transparent;
    border-right-color: #fff;
    border-left: none;
    z-index: 2;
}

/* Speech bubble with tail pointing right */
.speech-bubble-right {
    position: relative;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 20px 20px !important;
    margin-top: 22px;
    margin-bottom: 22px;
    margin-left: auto;
    margin-right: 20px; /* Space for the tail */
    display: block;
    max-width: calc(85% - 40px);
    width: fit-content;
    text-align: left; /* Keep text left-aligned inside bubble */
    clear: both;
}
.speech-bubble-right-right {
    text-align: right !important; /* special for right-aligned inside bubble */
}

/* Outer tail pointing right */
.speech-bubble-right::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -15px;
    left: auto;
    width: 0;
    height: 0;
    border: 15px solid transparent;
    border-left-color: #333;
    border-right: none;
    z-index: 1;
}

/* Inner tail pointing right (matches background) */
.speech-bubble-right::before {
    content: '';
    position: absolute;
    top: 22px;
    right: -12px;
    left: auto;
    width: 0;
    height: 0;
    border: 13px solid transparent;
    border-left-color: #fff;
    border-right: none;
    z-index: 2;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .speech-bubble-left {
        margin-left: 0px;
        max-width: calc(95% - 5px);
        padding: 8px 10px;
    }
    
    .speech-bubble-right {
        margin-left: auto;
        margin-right: 0px;
        max-width: calc(95% - 5px);
    }
}



/* Speech bubble with tail pointing up */
.speech-bubble-top {
    position: relative;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 15px 20px;
    margin: 20px 0;
    margin-top: 20px;
    display: inline-block;
    max-width: 100%;
}

.speech-bubble-top::after {
    content: '';
    position: absolute;
    top: -15px;
    left: 20px;
    width: 0;
    height: 0;
    border: 15px solid transparent;
    border-bottom-color: #333;
    border-top: none;
}

.speech-bubble-top::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 22px;
    width: 0;
    height: 0;
    border: 13px solid transparent;
    border-bottom-color: #fff;
    border-top: none;
}

/* Speech bubble with tail pointing down */
.speech-bubble-bottom {
    position: relative;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 15px 20px;
    margin: 20px 0;
    margin-bottom: 20px;
    display: inline-block;
    max-width: 100%;
}

.speech-bubble-bottom::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 20px;
    width: 0;
    height: 0;
    border: 15px solid transparent;
    border-top-color: #333;
    border-bottom: none;
}

.speech-bubble-bottom::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 22px;
    width: 0;
    height: 0;
    border: 13px solid transparent;
    border-top-color: #fff;
    border-bottom: none;
}

/* Dark mode support */
.dark .speech-bubble,
.dark .speech-bubble-left,
.dark .speech-bubble-right,
.dark .speech-bubble-top,
.dark .speech-bubble-bottom {
    background-color: #34353a;
    border-color: #c4c4c4;
    color: #eaeaea;
}

/* Dark mode - inner tails (background color) */
.dark .speech-bubble-left::before {
    border-right-color: #34353a;
}

.dark .speech-bubble-right::before {
    border-left-color: #34353a;
}

.dark .speech-bubble-top::before {
    border-bottom-color: #34353a;
}

.dark .speech-bubble-bottom::before {
    border-top-color: #34353a;
}

/* Dark mode - outer tails (border color) */
.dark .speech-bubble-left::after {
    border-right-color: #c4c4c4;
}

.dark .speech-bubble-right::after {
    border-left-color: #c4c4c4;
}

.dark .speech-bubble-top::after {
    border-bottom-color: #eaeaea;
}

.dark .speech-bubble-bottom::after {
    border-top-color: #eaeaea;
}

