/* START OF FILE style.css */

/* General body styling */
body {
    font-family: "Inter", sans-serif;
    background-color: #202123;
    color: #e5e5e5;
    margin: 0;
    display: flex;
    height: 100vh;
    /* Use dvh for dynamic viewport height - better on mobile */
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased; /* Smoother fonts */
    -moz-osx-font-smoothing: grayscale;
}

body, .message, .chatbox textarea, .logo-text, .game-title {
    font-family: 'Inter', sans-serif !important;
}

/* Main content styling */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 100%; /* Use 100% instead of 100vh */
    padding: 20px;
    box-sizing: border-box;
    position: relative; /* Anchor for absolute positioning */
}

/* Wrapper for content above the chat */
.content-above-chat {
    width: 100%;
    padding-top: 10vh;
    padding-bottom: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #202123;
}

/* Add fade overlay at the bottom of the logo area */
.content-above-chat::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    height: 50px;
    pointer-events: none;
    background: linear-gradient(
        to bottom,
        #202123 0%,
        rgba(32, 33, 35, 0.8) 40%,
        rgba(32, 33, 35, 0) 100%
    );
}

/* Logo styling */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 20px;
    pointer-events: auto;
    position: relative;
    z-index: 101;
}

/* Message fade line - invisible but maintains position reference */
.logo-container::after {
    display: none;
}

.logo {
    width: 50px; /* Slightly smaller */
    height: 50px;
    margin-right: 8px;
}

.logo-text {
    font-size: 2.2rem; /* Slightly smaller */
    font-weight: bold;
    color: #ffffff;
}


/* Chat Interface Container */
.chat-interface-container {
    width: 100%;
    max-width: 700px; /* Match the chatbox width */
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 180px);
    padding-top: 120px; /* Add space for logo area */
}

/* Remove any previous fade-related styles */
.chat-interface-container::before {
    display: none;
}

/* Message List Styling */
.message-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 5px 10px 5px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    position: relative; /* For absolute positioning of messages during animation */
}
.message-list::-webkit-scrollbar {
    display: none;
}

/* Ensure messages don't jump during animation */
.message-list > * {
    position: relative;
    z-index: 1;
}

/* Individual message bubble styling */
.message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.45;
    font-size: 0.95rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    will-change: transform, opacity;
}

.message.user {
    background-color: #44454a !important;
    color: #fff !important;
    align-self: flex-end;
    border-radius: 12px 12px 4px 12px !important;
    box-shadow: none !important;
    border: none !important;
    padding: 7px 13px !important;
    font-size: 0.97rem;
    margin-left: auto;
    margin-right: 0;
}

.message.ai {
    background: transparent !important;
    color: #e5e5e5 !important;
    box-shadow: none !important;
    border: none !important;
    padding: 10px 0 10px 0 !important;
    margin: 0 0 0 0 !important;
    align-self: flex-start;
    text-align: left;
    max-width: 85%;
}

/* Wrapper for status bubble and input box */
.chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    flex-shrink: 0;
}

/* Chat status/response bubble */
.chat-response {
    background-color: transparent;
    color: #a0a0a0;
    padding: 2px 10px;
    border-radius: 5px;
    display: none;
    font-size: 0.85rem;
    min-height: 18px;
    word-wrap: break-word;
    text-align: center;
    transition: opacity 0.3s ease;
    margin: 4px auto;
    max-width: 60%;
}

.chat-response.thinking {
    font-style: italic;
    color: #a0a0a0;
}

.chat-response.error-message {
    color: #ffdddd;
    background-color: transparent;
}

/* Chat input box */
.chatbox {
    display: flex;
    align-items: center !important;
    background-color: #343541;
    border-radius: 15px;
    padding: 4px 4px 4px 10px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid #4a4a4a;
    min-height: 44px; /* 10% higher than 40px */
    max-height: 44px;
    height: 44px;
    margin: 0 auto;
    width: 100%;
    max-width: 700px;
}

.chatbox textarea {
    flex-grow: 1;
    background-color: transparent;
    color: #e5e5e5;
    border: none;
    font-size: 1rem;
    resize: none;
    outline: none;
    line-height: 44px;
    min-height: 44px;
    max-height: 44px;
    height: 44px;
    overflow-y: auto;
    padding: 0 !important;
    margin: 0;
    scrollbar-width: thin;
    scrollbar-color: #6b6b6b #343541;
    text-align: left;
    padding-left: 8px;
}

/* Style the placeholder text */
.chatbox textarea::placeholder {
    color: #8e8e8e;
    line-height: 44px;
}

/* Scrollbar styles */
.chatbox textarea::-webkit-scrollbar {
    width: 6px;
}

.chatbox textarea::-webkit-scrollbar-track {
    background: #343541;
    border-radius: 3px;
}

.chatbox textarea::-webkit-scrollbar-thumb {
    background-color: #6b6b6b;
    border-radius: 3px;
}

.chatbox button {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    border-radius: 50%;
    width: 44px !important;
    height: 44px !important;
    margin-right: 4px !important;
    margin-left: 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    position: relative;
    top: 0;
}
.chatbox button:hover {
    background-color: #4a4a4a;
}

.chatbox button img {
    width: 28px !important;
    height: 28px !important;
    display: block;
}


/* === MOBILE STYLES === */
@media (max-width: 768px) {
    .main-content {
        padding: 15px; /* Reduce padding */
    }

    .content-above-chat {
        padding-top: 8vh; /* Adjust logo position for mobile */
    }

    .logo {
        width: 45px;
        height: 45px;
    }
    .logo-text {
        font-size: 2rem;
    }

    .chat-interface-container {
        width: calc(100% - 30px); /* Adjust width for padding */
        bottom: 15px; /* Closer to bottom */
        max-width: 95%; /* Allow wider on mobile */
        /* Adjust max-height calculation for mobile logo position */
        max-height: calc(100dvh - 150px); /* Example */
    }

    .message-list {
        /* Adjust fade height for mobile */
        -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 70px);
        mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 70px);
    }

    .message {
        max-width: 90%; /* Allow slightly wider bubbles */
        font-size: 0.9rem;
    }

     .chatbox textarea {
        font-size: 0.95rem;
    }
}

/* Add styles for markdown elements */
.message strong {
    font-weight: 700;
}

.message em {
    font-style: italic;
}

.message code {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

/* List styling */
.message ul {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message li {
    margin: 0.3em 0;
    line-height: 1.4;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background-color: #202123;
    margin: 20% auto;
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #444;
}

/* Matcher Title Styling within Modal Header */
.modal-header .matcher-title {
    font-size: 2em;
    font-weight: bold;
    color: #eee;
    text-align: center; /* Ensure text is centered */
    /* Added transition back */
    transition: color 0.3s ease, text-shadow 0.3s ease, font-size 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
    flex-grow: 1; /* Allow title to take up space and center text within it */
}

.modal-header .matcher-title.glowing {
    cursor: pointer;
    font-size: 2.25em; /* Slightly larger when glowing */
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 25px rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
    animation: glow 1.5s infinite;
}

/* Keyframes for glow animation (ensure this is present) */
@keyframes glow {
    0% { text-shadow: 0 0 5px rgba(255, 255, 255, 0.6), 0 0 15px rgba(255, 255, 255, 0.4); }
    50% { text-shadow: 0 0 15px rgba(255, 255, 255, 0.9), 0 0 25px rgba(255, 255, 255, 0.7); }
    100% { text-shadow: 0 0 5px rgba(255, 255, 255, 0.6), 0 0 15px rgba(255, 255, 255, 0.4); }
}

.close-button {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.3s ease;
}

.close-button:hover {
    color: #fff;
}

/* Update List Matcher styles for modal context */
.modal .list-inputs {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 20px;
    /* Ensure inputs stretch within flex container */
    align-items: stretch;
}

.modal .list-input {
    flex: 1;
    /* Ensure flex item is also a flex container for the textarea */
    display: flex;
    flex-direction: column;
}

.modal .list-input textarea {
    width: 100%;
    min-height: 200px; /* Changed from 67px to 200px */
    max-height: 600px;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid #444;
    border-radius: 8px;
    background-color: #333;
    color: #eee;
    font-family: inherit;
    resize: vertical;
    font-size: 1em;
    box-sizing: border-box;
}

.modal .matches-section {
    display: none;
    /* Use flexbox for consistency with inputs, or keep grid if preferred */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #444;
}

.modal .matches-container {
    background-color: #333;
    padding: 15px;
    border-radius: 8px;
    min-height: 100px;
}

.modal .matches-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #ffffff;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
}

.modal .matches-container div {
    color: #ddd;
    line-height: 1.6;
}

.modal .matches-container .no-matches {
    color: #888;
    font-style: italic;
}

/* Mobile styles for modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 15px;
    }

    .modal .list-inputs {
        flex-direction: column;
    }

    .modal .matches-section {
        grid-template-columns: 1fr;
    }
}

/* Remove old list-matcher-content styles */
.list-matcher-content {
    display: none;
}

/* END OF FILE style.css */

/* Subtle System Message Styling */
.message.subtle {
    text-align: center;
    font-size: 0.85rem; /* Slightly smaller than regular messages */
    color: #a0a0a0; /* A light gray color */
    margin: 4px auto; /* Further reduced vertical margin */
    padding: 2px 10px; /* Further reduced padding */
    background-color: transparent; /* No background bubble */
    max-width: 85%;
    border-radius: 5px;
    box-shadow: none; /* No shadow */
    align-self: center;
}

.list-matcher-modal {
    display: none;
    position: fixed;
    top: 20%; /* Changed from 50% to 20% */
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #1a1a1a;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Game Modal Styles */
.game-modal {
    animation: gameModalFadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.game-modal-content {
    width: 820px !important; /* 800px game + 20px padding */
    height: 660px !important; /* 600px game + 60px header */
    max-width: 90vw;
    max-height: 90vh;
    padding: 0 !important;
    background-color: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
}

.game-modal .modal-header {
    background-color: #2a2a2a;
    padding: 15px 20px;
    border-bottom: 2px solid #3a3a3a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(101, 163, 13, 0.5);
}

.game-close-button {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.game-close-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Game message styles */
.message.game {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 20px auto !important;
    width: 680px !important;
    height: 393px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: gameMessageSlideIn 0.5s ease-out;
}

.game-container {
    width: 680px !important;
    height: 393px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border-radius: 0 !important;
    overflow: hidden;
    border: none !important;
    box-sizing: border-box;
}

.game-container iframe {
    width: 680px !important;
    height: 393px !important;
    border: none !important;
    display: block;
    border-radius: 12px !important;
    background-color: #111 !important;
    margin: 0 auto;
}

@keyframes gameMessageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
        max-height: 0;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        max-height: 1000px;
    }
}

@keyframes gameMessageSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0);
        max-height: 1000px;
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }
}

@keyframes gameModalFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translate(-50%, -60%);
    }
    100% {
        opacity: 1;
        transform: scale(1) translate(-50%, -50%);
    }
}

/* Mobile responsiveness for game messages */
@media (max-width: 768px) {
    .message.game {
        width: 95%;
        height: 280px;
        margin: 5px auto;
    }
    
    .game-container {
        width: 100%;
        height: 280px;
    }
}