:root {
    --bg-color: #05080f;
    --primary-blue: #8cb0ff;
    --light-blue: #a3c3ff;
    --container-bg: rgba(12, 15, 26, 0.82);
    --border-color: rgba(77, 138, 255, 0.25);
    --text-color: #e1e1e1;
    --heading-color: #ffffff;
    --shadow-color: rgba(77, 138, 255, 0.2);
    --delete-color: #f44336;
    --success-color: #4CAF50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    min-height: 100vh;
    color: var(--heading-color);
}

.space-scene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    transition: transform 0.5s ease-out;
}

#twinkling-stars-container, #rotatingGalaxy, #roamingRobot {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.star {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    animation-name: twinkle;
    animation-iteration-count: infinite;
}

@keyframes twinkle {
    0%   { opacity: 0; transform: scale(0.5); }
    50%  { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.5); }
}

#rotatingGalaxy {
    top: 10px;
    right: 10px;
    width: 400px;
    height: auto;
    opacity: 0.35;
    transform: rotate(15deg);
}

#roamingRobot {
    position: fixed;
    width: 130px;
    height: auto;
    opacity: 0.8;
    z-index: -1;
    animation: roam-fullscreen 90s ease-in-out infinite;
}

@keyframes roam-fullscreen {
    0%   { bottom: 5%; left: 5%; transform: rotate(-15deg); }
    25%  { bottom: 50%; left: 75%; transform: rotate(20deg); }
    50%  { bottom: 60%; left: 10%; transform: rotate(-20deg); }
    75%  { bottom: 10%; left: 80%; transform: rotate(15deg); }
    100% { bottom: 5%; left: 5%; transform: rotate(-15deg); }
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
}

.back-to-hub-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    text-decoration: none;
    color: var(--light-blue);
    background: var(--container-bg);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    z-index: 100;
    font-weight: 600;
}
.back-to-hub-btn.small {
    padding: 5px 10px;
    font-size: 14px;
    flex-shrink: 0; /* Prevents the button from shrinking */
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h2 { font-size: 2.5rem; }
header p { font-size: 1.2rem; color: var(--primary-blue); }

.form-container, .content-box {
    background: var(--container-bg);
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.container-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}
.container-header h3 { font-size: 1.8rem; margin: 0; }

label { display: block; margin: 15px 0 8px 0; color: var(--light-blue); font-weight: 600; }
input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--heading-color);
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
}
textarea { resize: vertical; min-height: 100px; }
button, .button {
    font-family: 'Poppins', sans-serif;
    border: 1px solid;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
.primary-btn { background: var(--primary-blue); color: var(--bg-color); border-color: var(--primary-blue); }
.secondary-btn { background: none; color: var(--light-blue); border-color: var(--border-color); }
.delete-btn { background: var(--delete-color); color: white; border-color: var(--delete-color); }
button:hover { opacity: 0.9; transform: translateY(-2px); }

/* --- Bot Card V2 Styles --- */
.bot-card { background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); border-radius: 16px; padding: 25px; margin-bottom: 25px; display: flex; flex-direction: column; gap: 20px; }
.bot-card-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; }
.bot-card-header .bot-info h4 { font-size: 1.8rem; margin: 0;}
.bot-card-header .bot-info .bot-id { font-size: 0.8rem; color: var(--text-color); opacity: 0.7; }
.bot-types { display: flex; gap: 8px; }
.bot-type-tag { background: rgba(0,0,0,0.3); padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.bot-type-tag.active { border-color: var(--primary-blue); color: var(--primary-blue); }
.bot-card-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; }
.bot-card-actions .button { font-size: 14px; font-weight: 600; padding: 10px; text-align: center; }

/* --- Modal Styles --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: var(--bg-color); padding: 30px; border-radius: 15px; border: 1px solid var(--border-color); width: 90%; max-width: 700px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); }
.modal-body { max-height: 65vh; overflow-y: auto; padding: 15px; scrollbar-width: thin; scrollbar-color: var(--primary-blue) var(--bg-color); }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-bottom: 20px; }
.modal-close-btn { background: none; border: none; font-size: 32px; color: var(--text-color); padding: 0; line-height: 1; }
.checkbox-group { display: flex; gap: 20px; align-items: center; margin-bottom: 15px; flex-wrap: wrap; }
.checkbox-group input { width: auto; }
.action-buttons { display:flex; gap: 15px; justify-content: flex-end; margin-top: 20px; }
.modal-content.small { max-width: 500px; text-align: center;}
#toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; }
.toast { background-color: var(--container-bg); color: var(--text-color); padding: 15px 20px; margin-bottom: 10px; border-radius: 8px; border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0,0,0,0.5); }

/* --- Chat Page V2 Styles (Updated) --- */
.chat-page-container { display: flex; flex-direction: column; height: 100vh; width: 100%; max-width: 900px; margin: 0 auto; background: var(--container-bg); border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color); box-shadow: 0 0 50px rgba(0,0,0,0.5); }
#chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* This allows centering the title */
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-color);
    color: var(--heading-color);
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}
#bot-name-header {
    text-align: center;
    flex-grow: 1; /* Allows the title to take up space and center itself */
}
.header-placeholder {
    width: 44px; /* Matches the width of the back button to balance the header */
    flex-shrink: 0;
}
#chat-window { flex-grow: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.chat-message { max-width: 75%; padding: 12px 18px; border-radius: 18px; line-height: 1.6; word-wrap: break-word; }
.user-message { background-color: var(--primary-blue); color: var(--bg-color); margin-left: auto; border-bottom-right-radius: 4px; font-weight: 500; }
.bot-message { background-color: rgba(0,0,0,0.3); border: 1px solid var(--border-color); margin-right: auto; border-bottom-left-radius: 4px; }
.system-message { text-align: center; font-size: 14px; color: var(--text-secondary); padding: 10px; width: 100%; align-self: center; }
#chat-input-area { display: flex; padding: 15px; border-top: 1px solid var(--border-color); gap: 10px; align-items: flex-end; background: var(--bg-color); flex-shrink: 0; }
#message-input { flex-grow: 1; margin: 0; resize: none; max-height: 120px; border-radius: 20px; padding: 10px 20px; }
#mic-btn, #send-btn { width: 44px; height: 44px; margin: 0; cursor: pointer; background: var(--primary-blue); color: var(--bg-color); border: none; font-size: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
#mic-btn.recording { background-color: #f44336; animation: pulse-red 1.5s infinite; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(244, 67, 54, 0); } 100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0); } }

/* --- Documents Page Styles --- */
.upload-area { border: 2px dashed var(--border-color); border-radius: 10px; padding: 40px; text-align: center; cursor: pointer; transition: all 0.3s ease; }
.upload-area:hover, .upload-area.drag-over { background: rgba(140, 176, 255, 0.1); border-style: solid; border-color: var(--primary-blue); }
#documents-list ul { list-style-type: none; padding: 0; }
#documents-list li { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 8px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-color); }
.loading-placeholder { text-align: center; padding: 20px; color: var(--text-secondary); }