/* Inherit base vars from main CSS, adding chat specifics */
:root {
    --chat-bg: rgba(0, 0, 0, 0.25);
    --msg-bot-bg: rgba(255, 255, 255, 0.1);
    --msg-user-bg: #3498db;
    --chip-bg: rgba(241, 196, 15, 0.15);
    --chip-hover: rgba(241, 196, 15, 0.3);
    --chip-border: #f1c40f;
}

/* Layout Grid */
.main-layout {
    display: flex;
    gap: 20px;
    height: 75vh;
}

/* Chat Container */
.chat-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    overflow: hidden;
    position: relative;
    /* margin-bottom: 20px; Removed to fit flex layout */
    min-width: 0; /* Fix flex overflow */
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

/* Side Panel */
.draft-side-panel {
    /* Updated for 40% width layout as requested */
    width: 40%;
    flex: 0 0 40%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    padding: 15px;
    transition: all 0.3s ease;
    overflow: hidden; 
}

.draft-side-panel.hidden {
    width: 0;
    flex: 0 0 0; /* Ensures it collapses fully */
    padding: 0;
    opacity: 0;
    margin: 0;
    border: none;
    overflow: hidden;
}

.panel-header {
    text-align: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}
.panel-header h3 { margin: 0; color: #f1c40f; }
.panel-header span { font-size: 0.9rem; color: #ccc; }

/* NEW: Layout Wrapper for Map + Teams */
.panel-content-row {
    display: flex;
    flex-direction: row;
    gap: 15px;
    flex-grow: 1;
    min-height: 0; /* Vital for flex nesting */
}

.panel-map-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    padding: 5px;
}

.panel-map-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 5px;
    object-fit: contain;
}

.panel-teams {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly; /* Distribute blue/red vertically */
    gap: 10px;
    overflow-y: auto;
}

.panel-team {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.panel-team h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    text-align: center;
    text-transform: uppercase;
}
.panel-team.blue h4 { color: #3498db; }
.panel-team.red h4 { color: #e74c3c; }

.panel-bans, .panel-picks {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin-bottom: 5px;
}

.panel-slot {
    width: 35px;
    height: 35px;
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    background: rgba(0,0,0,0.2);
}

.panel-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Make picks slightly larger */
.panel-picks .panel-slot {
    width: 45px;
    height: 45px;
    border-style: solid;
}

.panel-status {
    margin-top: 10px;
    text-align: center;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    flex-shrink: 0;
}

/* NEW: Style for the Permanent Draft Tool Button */
.panel-tool-btn {
    display: none; /* Hidden by default until active */
    margin-top: 15px;
    text-align: center;
    padding: 12px;
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: #fff;
    text-decoration: none;
    border-radius: 15px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.panel-tool-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(243, 156, 18, 0.4);
    background: linear-gradient(45deg, #f1c40f, #f39c12);
}

.panel-tool-btn i {
    margin-right: 8px;
}

/* Messages */
.message {
    max-width: 85%;
    padding: 15px;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.bot {
    align-self: flex-start;
    background: var(--msg-bot-bg);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message.user {
    align-self: flex-end;
    background: var(--msg-user-bg);
    border-bottom-right-radius: 4px;
    color: white;
}

.message strong {
    color: #f1c40f;
}

/* Images in Chat (Simple Grid) */
.chat-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.chat-card {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    width: 100px;
    transition: transform 0.2s;
}

.chat-card:hover {
    transform: scale(1.05);
}

.chat-card img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-bottom: 5px;
}

.chat-card span {
    display: block;
    font-size: 0.8rem;
    color: #fff;
}

/* Detailed Recommendation Table (New) */
.rec-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9rem;
}
.rec-table th {
    text-align: left;
    color: #aaa;
    font-weight: normal;
    padding-bottom: 5px;
    font-size: 0.8rem;
}
.rec-table td {
    padding: 8px 5px;
    border-top: 1px solid rgba(255,255,255,0.1);
    vertical-align: middle;
}
.rec-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rec-icon-lg {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}
.rec-name {
    font-weight: bold;
    color: #fff;
    display: block;
}
.rec-score {
    color: #f1c40f;
    font-size: 0.8rem;
}
.continuation-icons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.continuation-icons img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
}
.continuation-icons img.is-ban {
    filter: grayscale(100%);
    opacity: 0.7;
    border: 1px dotted #e74c3c;
}

/* Input Area */
.input-area {
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Chips (Pre-determined answers) */
.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    min-height: 40px;
}

.chat-chip {
    background: var(--chip-bg);
    border: 1px solid var(--chip-border);
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Lilita One', cursive;
    font-size: 1rem;
    transition: all 0.2s;
}

.chat-chip:hover {
    background: var(--chip-hover);
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
}

/* Typing Input (Hidden by default) */
.text-input-wrapper {
    display: none; /* Hidden unless context requires it */
    position: relative;
    width: 100%;
}

.text-input-wrapper.active {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex-grow: 1;
    padding: 15px;
    border-radius: 25px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-family: 'Lilita One', cursive;
    font-size: 1rem;
}

.chat-input:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(45deg, #f1c40f, #f39c12);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.1);
}

/* Auto-complete list styling (reuse bsdraft styles but scoped) */
.chat-suggestions {
    position: absolute;
    bottom: 110%; /* Above input */
    left: 0;
    width: 100%;
    background: #2c2c2c;
    border-radius: 15px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.2);
    display: none;
    z-index: 100;
}

/* Loading dots */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px;
    opacity: 0.7;
}

.dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

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

@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
        height: auto;
    }
    .chat-wrapper {
        height: 70vh;
    }
    
    /* Revert to stacking on mobile */
    .draft-side-panel {
        width: 100%;
        flex: auto;
        max-height: 300px;
    }
    
    .panel-content-row {
        flex-direction: row; /* Keep side-by-side on mobile landscape if room, or adjust */
    }

    /* If mobile screen is very narrow, maybe stack them again inside the panel? */
    @media (max-width: 600px) {
        .panel-content-row {
            flex-direction: column;
        }
        .draft-side-panel {
             max-height: none; /* Let it grow */
        }
    }

    .draft-side-panel.hidden {
        max-height: 0;
    }
}