/**
 * Brona Roleplay Chat - Frontend Styles
 * Color Scheme:
 * - Brick/Coral: #F87760
 * - Enthusiastic Blue: #5271ff
 * - Dark Blue: #1E3D6B
 * - Yellow: #FFCF4D
 * - Gray: #F7F6F4
 * - Headings: Poppins semibold, #2165B2
 * - Body text: Poppins regular, #2A558C
 */

/* Wrapper */
.brona-roleplay-wrapper {
    max-width: 700px;
    margin: 0 auto;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(30, 61, 107, 0.1);
    overflow: hidden;
}

/* Header */
.brona-roleplay-header {
    background: #1E3D6B;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
}

.brona-roleplay-scenario-info {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.brona-roleplay-icon {
    font-size: 32px;
    line-height: 1;
}

.brona-roleplay-scenario-text strong {
    display: block;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    font-family: 'Poppins', sans-serif;
}

.brona-roleplay-scenario-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.brona-roleplay-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.brona-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.2);
}

.brona-badge-level {
    background: rgba(255, 207, 77, 0.3);
}

.brona-badge-tone {
    background: rgba(248, 119, 96, 0.3);
}

/* Chat Container */
.brona-roleplay-chat-container {
    height: 400px;
    overflow-y: auto;
    background: #F7F6F4;
    scroll-behavior: smooth;
}

.brona-roleplay-messages {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Messages */
.brona-roleplay-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.brona-roleplay-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.brona-roleplay-message-assistant {
    align-self: flex-start;
}

.brona-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(30, 61, 107, 0.1);
}

.brona-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 15px;
}

.brona-roleplay-message-user .brona-message-bubble {
    background: #1E3D6B;
    color: white;
    border-bottom-right-radius: 4px;
}

.brona-roleplay-message-assistant .brona-message-bubble {
    background: white;
    color: #2A558C;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(30, 61, 107, 0.1);
}

/* Typing Indicator */
.brona-typing-indicator .brona-message-bubble {
    padding: 12px 20px;
}

.typing-dots span {
    animation: typingDot 1.4s infinite;
    font-size: 20px;
    font-weight: bold;
    color: #5271ff;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {

    0%,
    60%,
    100% {
        opacity: 0.3;
    }

    30% {
        opacity: 1;
    }
}

/* Input Area */
.brona-roleplay-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.brona-roleplay-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.brona-roleplay-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    font-size: 15px;
    resize: none;
    font-family: 'Poppins', sans-serif;
    color: #2A558C;
    line-height: 1.4;
    transition: border-color 0.2s;
}

.brona-roleplay-input:focus {
    outline: none;
    border-color: #5271ff;
}

.brona-roleplay-input::placeholder {
    color: #999;
}

.brona-roleplay-send-btn {
    padding: 12px 24px;
    background: #1E3D6B;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.brona-roleplay-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(82, 113, 255, 0.4);
}

.brona-roleplay-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.brona-roleplay-input-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #2A558C;
}

.brona-roleplay-char-count.near-limit {
    color: #F87760;
}

/* Controls */
.brona-roleplay-controls {
    display: flex;
    gap: 10px;
    padding: 0 20px 16px;
    background: white;
}

.brona-roleplay-restart-btn,
.brona-roleplay-hint-btn {
    padding: 8px 16px;
    border: 1px solid #e9ecef;
    background: white;
    border-radius: 20px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    color: #2A558C;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.brona-roleplay-restart-btn:hover {
    background: #F7F6F4;
    border-color: #F87760;
    color: #F87760;
}

.brona-roleplay-hint-btn:hover {
    background: #F7F6F4;
    border-color: #FFCF4D;
    color: #1E3D6B;
}

.brona-roleplay-hint-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Tips Panel */
.brona-roleplay-tips-panel {
    margin: 0 20px 20px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 207, 77, 0.15);
    border: 1px solid rgba(255, 207, 77, 0.5);
    animation: fadeInUp 0.3s ease;
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Tips updating animation */
.brona-tips-updating {
    opacity: 0.5;
    transform: scale(0.98);
}

.brona-tips-updated {
    animation: tipPulse 0.6s ease;
}

@keyframes tipPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 207, 77, 0.7);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(255, 207, 77, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 207, 77, 0);
    }
}

.brona-tips-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #1E3D6B;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

.brona-tips-header span {
    font-size: 20px;
}

.brona-tips-content {
    font-size: 14px;
    line-height: 1.6;
    color: #2A558C;
}

.brona-tips-content p {
    margin: 0;
}

.brona-corrected-version {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 207, 77, 0.5);
}

.brona-corrected-text {
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-style: italic;
    color: #2165B2;
}

/* Tip Types */
.brona-tips-error {
    background: rgba(248, 119, 96, 0.1);
    border-color: rgba(248, 119, 96, 0.3);
}

.brona-tips-error .brona-tips-content {
    color: #F87760;
}

.brona-tips-warning {
    background: rgba(255, 207, 77, 0.15);
    border-color: rgba(255, 207, 77, 0.5);
}

.brona-tips-warning .brona-tips-content {
    color: #1E3D6B;
}

.brona-tips-hint {
    background: rgba(30, 61, 107, 0.1);
    border-color: rgba(30, 61, 107, 0.3);
}

.brona-tips-hint .brona-tips-content {
    color: #5271ff;
}

/* Login/Access Denied */
.brona-roleplay-login-required,
.brona-roleplay-access-denied {
    max-width: 500px;
    margin: 20px auto;
    padding: 30px;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(30, 61, 107, 0.1);
}

.brona-roleplay-login-required p,
.brona-roleplay-access-denied p {
    font-size: 16px;
    color: #2A558C;
    margin-bottom: 20px;
}

.brona-login-btn {
    display: inline-block;
    padding: 12px 30px;
    background: #1E3D6B;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    transition: transform 0.2s;
}

.brona-login-btn:hover {
    transform: translateY(-2px);
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    .brona-roleplay-header {
        flex-direction: column;
        gap: 12px;
    }

    .brona-roleplay-chat-container {
        height: 350px;
    }

    .brona-roleplay-message {
        max-width: 90%;
    }

    .brona-roleplay-input-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    .brona-roleplay-send-btn {
        width: 100%;
    }

    .brona-roleplay-controls {
        flex-direction: column;
    }

    .brona-roleplay-restart-btn,
    .brona-roleplay-hint-btn {
        width: 100%;
        text-align: center;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .brona-roleplay-wrapper {
        background: #1E3D6B;
    }

    .brona-roleplay-chat-container {
        background: #2A558C;
    }

    .brona-message-avatar {
        background: #1E3D6B;
    }

    .brona-roleplay-message-assistant .brona-message-bubble {
        background: #1E3D6B;
        color: #F7F6F4;
    }

    .brona-roleplay-input-area {
        background: #1E3D6B;
        border-top-color: #2A558C;
    }

    .brona-roleplay-input {
        background: #2A558C;
        border-color: #5271ff;
        color: #F7F6F4;
    }

    .brona-roleplay-input:focus {
        border-color: #FFCF4D;
    }

    .brona-roleplay-controls {
        background: #1E3D6B;
    }

    .brona-roleplay-restart-btn,
    .brona-roleplay-hint-btn {
        background: #2A558C;
        border-color: #5271ff;
        color: #F7F6F4;
    }

    .brona-roleplay-restart-btn:hover,
    .brona-roleplay-hint-btn:hover {
        background: #5271ff;
    }

    .brona-roleplay-tips-panel {
        background: rgba(255, 207, 77, 0.1);
        border-color: rgba(255, 207, 77, 0.3);
    }

    .brona-tips-header {
        color: #FFCF4D;
    }

    .brona-tips-content {
        color: #F7F6F4;
    }
}