/* ========================================
   FANTASY CHAT THEME - LYRA VALEBRIGHT
   VERSION: 2024-11-25-v2 (Grid Layout Fix)
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 100%;
    width: 100%;
    font-family: 'Georgia', 'Times New Roman', serif;
    overflow: hidden;
}

/* ========================================
   BACKGROUND
   ======================================== */

.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a0e2e 0%, #2d1b3d 50%, #1a0e2e 100%);
    z-index: -2;
}

.gradient-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.4) 100%);
    z-index: -1;
}

/* ========================================
   MAIN LAYOUT
   ======================================== */

.main-layout {
    display: flex;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    gap: 20px;
    padding: 20px;
}

/* ========================================
   LEFT SIDEBAR - CHARACTER SHOWCASE
   ======================================== */

.character-sidebar {
    flex: 0 0 400px;
    background: rgba(15, 10, 25, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 16px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(212, 175, 55, 0.2);
}

.character-sidebar::-webkit-scrollbar {
    width: 6px;
}

.character-sidebar::-webkit-scrollbar-track {
    background: rgba(212, 175, 55, 0.1);
    border-radius: 3px;
}

.character-sidebar::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.4);
    border-radius: 3px;
}

.character-profile {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.character-main-image {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
}

.main-img {
    width: 100%;
    height: auto;
    display: block;
}

.character-bio {
    text-align: center;
}

.bio-name {
    font-size: 28px;
    font-weight: 700;
    color: #d4af37;
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(212, 175, 55, 0.5);
}

.bio-title {
    font-size: 14px;
    color: #b8860b;
    font-style: italic;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.bio-description {
    font-size: 14px;
    line-height: 1.7;
    color: #e9d5ff;
    text-align: left;
}

.character-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.gallery-img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.gallery-img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
}

/* ========================================
   RIGHT SIDE - CHAT SECTION
   ======================================== */

.chat-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-container {
    width: 100%;
    max-width: 700px;
    height: 85vh;
    max-height: 700px;
    background: rgba(15, 10, 25, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(212, 175, 55, 0.2);
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
}

/* ========================================
   CHARACTER HEADER
   ======================================== */

.character-header {
    display: flex;
    align-items: center;
    padding: 20px;
    background: rgba(25, 15, 40, 0.9);
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    gap: 15px;
}

.character-avatar {
    position: relative;
}

.avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #d4af37;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
    object-fit: cover;
}

.character-info {
    flex: 1;
}

.character-name {
    font-size: 20px;
    font-weight: 600;
    color: #d4af37;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.character-subtitle {
    font-size: 13px;
    color: #b8860b;
    font-style: italic;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 11px;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   CHAT MESSAGES AREA
   ======================================== */

.chat-messages {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(212, 175, 55, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.4);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.6);
}

/* Message bubbles */
.message {
    display: flex;
    gap: 12px;
    animation: fadeInUp 0.4s ease;
    max-width: 85%;
}

.message.lyra {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid #d4af37;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Arial', sans-serif;
    border-color: #8b5cf6;
}

.message-content {
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 12px 16px;
    border-radius: 12px;
    color: #e9d5ff;
    font-size: 15px;
    line-height: 1.5;
}

.message.user .message-content {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #e9d5ff;
}

/* Detection info styling */
.detection-info {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(212, 175, 55, 0.3);
    border-radius: 6px;
    margin: 4px 0;
    font-weight: 600;
    color: #d4af37;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   TYPING INDICATOR
   ======================================== */

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    width: fit-content;
    margin-left: 52px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d4af37;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ========================================
   CHAT INPUT AREA
   ======================================== */

.chat-input-container {
    padding: 15px 20px 20px 20px;
    background: rgba(25, 15, 40, 0.9);
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    max-height: 250px;
    overflow-y: auto;
}

/* Button options */
.button-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-button {
    padding: 14px 20px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 10px;
    color: #e9d5ff;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.option-button:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: rgba(212, 175, 55, 0.6);
    transform: translateX(5px);
}

.option-button:active {
    transform: scale(0.98);
}

/* CTA Button (final step) */
.cta-button {
    padding: 16px 32px;
    background: linear-gradient(135deg, #d4af37, #f4d03f);
    border: none;
    border-radius: 12px;
    color: #1a0e2e;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Georgia', 'Times New Roman', serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
    background: linear-gradient(135deg, #f4d03f, #d4af37);
}

.cta-button:active {
    transform: scale(0.98);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .character-sidebar {
        flex: 0 0 320px;
    }

    .bio-name {
        font-size: 24px;
    }

    .bio-description {
        font-size: 13px;
    }
}

@media (max-width: 992px) {
    .main-layout {
        flex-direction: column;
        padding: 10px;
        gap: 15px;
        overflow-y: auto;
    }

    .character-sidebar {
        flex: none;
        width: 100%;
        max-height: 400px;
    }

    .character-main-image {
        max-height: 300px;
    }

    .main-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .chat-section {
        flex: 1;
    }

    .chat-container {
        height: 500px;
    }

    body, html {
        overflow: auto;
    }
}

@media (max-width: 768px) {
    .main-layout {
        padding: 5px;
        gap: 10px;
    }

    .character-sidebar {
        padding: 15px;
    }

    .character-gallery {
        grid-template-columns: 1fr;
    }

    .character-header {
        padding: 15px;
    }

    .character-name {
        font-size: 18px;
    }

    .avatar-img {
        width: 50px;
        height: 50px;
    }

    .chat-messages {
        padding: 15px;
    }

    .message-content {
        font-size: 14px;
    }

    .option-button {
        padding: 12px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .character-sidebar {
        max-height: 350px;
    }

    .bio-name {
        font-size: 20px;
    }

    .bio-title {
        font-size: 12px;
    }

    .bio-description {
        font-size: 12px;
    }

    .message {
        max-width: 90%;
    }

    .chat-container {
        border-radius: 8px;
    }
}
