/* Basic Setup */
body {
    background-color: #1a0a24; /* Dark purple background */
    color: #e0e0e0;
    font-family: sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* Screen container - mimics a phone screen */
body > div {
    width: 100%;
    max-width: 400px;
    height: 100vh;
    max-height: 800px;
    background-color: #2b1a3d;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
}

.exo-body {
    font-family: "Exo", sans-serif;
    font-optical-sizing: auto;
    font-weight: light;
    font-style: normal;
    font-size: 1 rem;
  }

/* Screen visibility */
.screen {
    display: none;
}
.screen.active {
    display: flex;
}

/* Start Screen */
#start-screen {
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#start-screen h1 {
    /* Luna Archives */
    font-family: 'Krona One';
    font-style: normal;
    font-weight: 400;
    font-size: 36px;
    line-height: 45px;
    display: flex;
    align-items: center;
    text-align: center;
    color: #FFFFFF;
    margin: 0 0 40px 0;
    width: 266px;
    height: 90px;
}

#play-button {
    /* Rectangle 1 */
    width: 223px;
    height: 48px;
    background: rgba(217, 217, 217, 0.2);
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#play-button::before {
    /* Play */
    content: "Play";
    font-family: 'Exo';
    font-style: normal;
    font-weight: 300;
    font-size: 16px;
    line-height: 21px;
    text-align: center;
    color: #FFFFFF;
}

/* Chat List Screen Styling */
.chat-list-header {
    height: 26px;
    padding: 22px 13px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
}

.chat-list-header-content {
    /* Frame 5 - adjusted for phone screen */
    width: 100%;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-list-title-container {
    display: flex;
    align-items: center;
    gap: 13px;
}

.chat-list-arrow {
    /* Vector 1 */
    width: 15px;
    height: 15px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.back-arrow-image {
    width: 15px;
    height: 15px;
    object-fit: contain;
}

.chat-list-title {
    /* Luna Archives */
    font-family: 'Krona One';
    font-style: normal;
    font-weight: 400;
    font-size: 20px;
    line-height: 25px;
    color: #FFFFFF;
    margin: 0;
    flex: 1;
}

.chat-list-avatar {
    /* Ellipse 1 */
    width: 26px;
    height: 26px;
    background: rgba(217, 217, 217, 0.5);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Chat Screen Styling */
header {
    /* Frame 4 styling */
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 12px 12px;
    gap: 10px;
    
    background: rgba(217, 217, 217, 0.2);
    border-radius: 0px 0px 12px 12px;
    z-index: 1000;
}

/* Frame 3 - Inner header container */
.header-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0px 6px;
    gap: 12px;
    width: 100%;
    height: 37px;
    flex: none;
    order: 0;
    flex-grow: 1;
}

#back-button {
    /* Vector 1 styling */
    width: 15px;
    height: 0px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    order: 0;
    flex-grow: 0;
    padding: 0;
}

#back-button svg {
    width: 15px;
    height: 15px;
}

/* Avatar placeholder */
.avatar-placeholder {
    width: 32px;
    height: 32px;
    background: rgba(217, 217, 217, 0.5);
    border-radius: 50%;
    flex: none;
    order: 1;
    flex-grow: 0;
}

/* Chat info styling - Frame 2 */
.chat-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0px;
    flex: 1;
    min-width: 0;
    height: 37px;
    flex: none;
    order: 2;
    flex-grow: 1;
}

#chat-title {
    font-family: 'Exo';
    font-style: normal;
    font-weight: 300;
    font-size: 16px;
    line-height: 21px;
    color: #FFFFFF;
    margin: 0;
    flex: none;
    order: 0;
    align-self: stretch;
    flex-grow: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#chat-members {
    font-family: 'Exo';
    font-style: normal;
    font-weight: 300;
    font-size: 12px;
    line-height: 16px;
    color: #FFFFFF;
    margin: 0;
    flex: none;
    order: 1;
    align-self: stretch;
    flex-grow: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#message-container {
    flex-grow: 1;
    padding: 10px;
    padding-bottom: 100px; /* Add more space for the continue button and transition messages */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px); /* Ensure it doesn't exceed viewport */
    min-height: 0; /* Allow flex shrinking */
}

.message {
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 8px;
    max-width: 75%;
}

.received {
    background-color: #4a3a5d;
    align-self: flex-start;
}

.sent {
    background-color: #5a4a6d; /* Player's message color */
    align-self: flex-end;
}

.end-of-chat {
    background-color: #3a2a4d !important;
    border: 1px solid #5a4a6d;
    text-align: center;
    font-style: italic;
    opacity: 0.8;
}

.end-of-chat .text {
    margin: 0;
    color: #a0a0a0;
}

.continue-button-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    background-color: #2b1a3d;
    z-index: 1000;
}

.continue-btn {
    width: 100%;
    background-color: #4a3a5d;
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
    text-align: left;
}

.continue-btn:hover {
    background-color: #5a4a6d;
}

#choices-container {
    padding: 15px;
}

/* Progress Bar Styling */
.progress-bar-container {
    padding: 24px;
}

.progress-bar {
    height: 40px;
    background: rgba(217, 217, 217, 0.2);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 16px;
}

.progress-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(217, 217, 217, 0.6);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-bar-text {
    font-family: 'Exo';
    font-style: normal;
    font-weight: 300;
    font-size: 16px;
    color: #FFFFFF;
    z-index: 1;
    position: relative;
}

#chat-list-container {
    padding: 0 21px;
    list-style: none;
    margin: 0;
}

#choices-container button {
    width: 100%;
    background-color: #4a3a5d;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 20px;
    margin-top: 5px;
    cursor: pointer;
}

/* Add these new styles to your style.css file */

.message .author {
    font-weight: bold;
    margin-bottom: 4px;
    color: #c0b0d0; /* Lighter color for the name */
}

.message .text {
    margin: 0;
    line-height: 1.4;
}

.message .timestamp {
    font-size: 0.75em;
    color: #a090b0;
    text-align: right;
    margin-top: 5px;
    display: block; /* Make it take its own line */
}

/* Chat transition notification styles */
.message.chat-transition {
    background-color: #3a2a4d;
    border: 1px solid #5a4a6d;
    text-align: center;
    margin: 10px auto;
    max-width: 80%;
}

.message.chat-transition .text {
    margin-bottom: 10px;
    color: #d0c0e0;
}

.transition-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.go-to-chat-btn, .auto-navigate-btn {
    background-color: #6a5a7d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.go-to-chat-btn:hover, .auto-navigate-btn:hover {
    background-color: #7a6a8d;
}

.auto-navigate-btn {
    background-color: #4a3a5d;
}

.auto-navigate-btn:hover {
    background-color: #5a4a6d;
}

/* Chat list new message indicators */
/* .chat-item.has-new-messages {
    background-color: #3a2a4d;
    border-left: 3px solid #6a5a7d;
} */

.new-message-indicator {
    color: #ff6b6b;
    font-size: 1.2em;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.date-divider {
    align-self: center;
    background-color: #4a3a5d;
    color: #e0e0e0;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    margin: 10px 0;
}

/* Updated style for chat list items */
.chat-item {
    /* Group 1 - adjusted for phone screen */
    width: 100%;
    max-width: 366px;
    height: 48px;
    margin: 0 0 20px 0;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    position: relative;
}

.chat-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.chat-item-avatar {
    /* Ellipse 1 */
    width: 46px;
    height: 48px;
    background: rgba(217, 217, 217, 0.5);
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 15px;
}

.chat-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.chat-item-title {
    /* Group Chat */
    font-family: 'Exo';
    font-style: normal;
    font-weight: 300;
    font-size: 20px;
    line-height: 27px;
    color: #FFFFFF;
    margin: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-timestamp {
    /* 21:05 */
    font-family: 'Exo';
    font-style: normal;
    font-weight: 300;
    font-size: 12px;
    line-height: 16px;
    text-align: right;
    color: #FFFFFF;
    margin: 0;
    flex-shrink: 0;
    margin-left: 10px;
}

.chat-item-unread-indicator {
    /* Frame 8 */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 2px 9px;
    gap: 10px;
    width: 48px;
    height: 25px;
    background: rgba(217, 217, 217, 0.4);
    border-radius: 12px;
    flex: none;
    order: 1;
    flex-grow: 0;
    position: relative;
    justify-content: center;
    align-items: center;
}

.chat-item-unread-count {
    /* Frame 7 */
    width: 29.5px;
    height: 21px;
    flex: none;
    order: 0;
    flex-grow: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-item-unread-number {
    /* 3 */
    font-family: 'Exo';
    font-style: normal;
    font-weight: 700;
    font-size: 16px;
    line-height: 21px;
    text-align: right;
    color: #FFFFFF;
    margin: 0;
    flex: 1;
}

.chat-item-unread-arrow {
    /* Vector 2 */
    width: 17px;
    height: 16px;
    margin-left: 5px;
    flex-shrink: 0;
}

.chat-item-message {
    /* Jax: last chat message */
    font-family: 'Exo';
    font-style: normal;
    font-weight: 300;
    font-size: 12px;
    line-height: 16px;
    color: #FFFFFF;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hide the choices container by default */
#choices-container {
    display: none;
    padding: 15px;
}

/* Typing indicator bubble */
.typing-indicator {
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 8px;
    background-color: #4a3a5d;
    align-self: flex-start;
    display: flex;
    align-items: center;
}

/* Animated dots */
.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #a090b0;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-of-type(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-of-type(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    } 40% {
        transform: scale(1.0);
    }
}

/* Character-specific message colors */
.message.character-arc-a {
    border: 3px solid #ffffff;
    background-color: #1a0a24;
    font-family: monospace;
    font-size: 1.2em;
    max-width: 100%;
    min-width: 90%;
}

.message.character-alana {
    background-color: #5a4a6d; /* Player's message color - keep existing */
    font-family: "Exo", sans-serif;
    font-optical-sizing: auto;
    font-weight: 300;
    font-style: normal;
    font-size: 16px;
    
}

.message.character-jax {
    background-color: #3F3333; /* Green for Jax */
    font-family: "Exo", sans-serif;
    font-optical-sizing: auto;
    font-weight: 300;
    font-style: normal;
    font-size: 16px;
}

.message.character-lena {
    background-color: #293149; /* Blue for Lena */
    font-family: "Exo", sans-serif;
    font-optical-sizing: auto;
    font-weight: li300ght;
    font-style: normal;
    font-size: 16px;
}

.message.character-system {
    background-color: #2a3a4d; /* Blue-gray for system messages */
    border-left: 3px solid #4a5a6d;
    font-style: italic;
}

/* Ensure character names are visible with appropriate contrast */
.message.character-arc-a .author {
    color: #ffffff; /* Light green for ARC-A */
    font-size: 0.8 rem;
}

.message.character-jax .author {
    font-size:  12px;
    color: #ffffff;
}

.message.character-lena .author {
    font-size: 12px;
    color: #ffffff;
}

.message.character-system .author {
    color: #7aa8a8; /* Light blue-gray for system */
}