:root {
    --bg-color: #030712; /* Deep true black/navy */
    --card-bg: rgba(15, 23, 42, 0.65); /* Sleek translucent slate */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #6366f1; /* Premium Indigo */
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --danger-color: #f87171;
    --success-color: #34d399;
    --chat-user-bg: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --chat-bot-bg: rgba(30, 41, 59, 0.8);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Custom Scrollbar for Dark Theme */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    /* Immersive glowing background dots */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(52, 211, 153, 0.05) 0%, transparent 50%);
}

.app-container {
    width: 100%;
    max-width: 800px;
    height: 92vh;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8), 
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

/* Header */
.app-header {
    padding: 20px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(3, 7, 18, 0.4);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background-color: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--success-color), 0 0 4px var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.brand h1 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.trainer-toggle-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.trainer-toggle-btn:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 15px var(--border-glow);
}

/* Chat Messages Area */
.chat-container {
    flex: 1;
    position: relative;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.4s ease forwards;
}

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

.assistant-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.assistant-message .message-bubble {
    background: var(--chat-bot-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-top-left-radius: 4px;
}

.user-message .message-bubble {
    background: var(--chat-user-bg);
    color: #fff;
    border-top-right-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Trainer Panel Overlay */
.trainer-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.98);
    backdrop-filter: blur(15px);
    z-index: 10;
    padding: 28px;
    display: flex;
    flex-direction: column;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.trainer-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px) scale(0.98);
}

.trainer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.trainer-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--danger-color);
}

.trainer-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.trainer-body input, .trainer-body textarea {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    resize: none;
    transition: all 0.3s ease;
}

.trainer-body textarea {
    height: 120px;
}

.trainer-body input:focus, .trainer-body textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(15, 23, 42, 0.9);
}

.train-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.train-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.trainer-status {
    font-size: 0.9rem;
    text-align: center;
    margin-top: 5px;
    font-weight: 500;
}

/* Footer Input Area */
.chat-input-area {
    padding: 20px 28px;
    border-top: 1px solid var(--border-color);
    background: rgba(3, 7, 18, 0.6);
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 8px 8px 20px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(15, 23, 42, 1);
}

.input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
}

.input-wrapper input::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    background: var(--chat-user-bg);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.5);
}

/* Trained Q&A List Styling */
.trained-list-container {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.trained-list-container h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.trained-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 6px;
}

.trained-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.trained-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.trained-item-info {
    font-size: 0.85rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
}

.trained-item-info strong {
    color: var(--accent-color);
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.delete-q-btn {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(248, 113, 113, 0.2);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.delete-q-btn:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
    box-shadow: 0 0 10px rgba(248, 113, 113, 0.4);
}

/* File Upload Styles */
.train-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.01);
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 12px;
}

.file-upload-section p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-upload-section input[type="file"] {
    font-size: 0.85rem;
    color: var(--text-primary);
    padding: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

.file-btn {
    background: var(--success-color);
    box-shadow: 0 4px 15px rgba(52, 211, 153, 0.2);
}

.file-btn:hover {
    background: #059669;
    box-shadow: 0 6px 20px rgba(52, 211, 153, 0.4);
}
/* Fix for button click blocking */
.trainer-panel.hidden {
    display: none !important;
}
