/* Modern Premium Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #0B132B; /* Premium Deep Midnight Blue */
    color: #F4F6F8;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Premium Navigation Header User Bar --- */
.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 40px;
    background: #111A36;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    flex-shrink: 0;
    z-index: 100;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.95rem;
}

.user-name {
    font-weight: 700;
    color: #FFFFFF;
}

.user-email {
    color: #A5B4FC;
    opacity: 0.8;
}

/* Authentication Sync Status Badges */
.status-badge {
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.sync-active {
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.status-badge.sync-inactive {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* Premium Crimson SVG Logout Button */
.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #EF4444;
    color: #FFFFFF;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.1s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-btn svg {
    transition: transform 0.2s ease;
}

.logout-btn:hover {
    background: #DC2626;
}

.logout-btn:hover svg {
    transform: translateX(2px);
}

.logout-btn:active {
    transform: scale(0.97);
}

/* 2-Column Desktop Grid Layout */
.portal-container {
    display: grid;
    grid-template-columns: 1.41fr 1fr; /* Main Content Panel | Custom Chatbot Panel */
    gap: 40px;
    width: 100%;
    flex: 1;
    height: calc(100vh - 73px); /* Accounts perfectly for header element space bounds */
    padding: 40px;
    align-items: start;
}

/* --- Left Column: Content Flow --- */
.content-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100%;
    overflow-y: auto;
    padding-right: 10px;
}

.content-column::-webkit-scrollbar {
    width: 6px;
}
.content-column::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.header-block h1 {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #FFFFFF 0%, #90E0EF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-block .subtitle {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #4EA8DE;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.header-block p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #A5B4FC;
    margin: 0;
}

.video-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Fixed 16:9 Aspect Ratio */
    background: #1C2541;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    height: 100%;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.2s ease;
}

.feature-card.clickable-card {
    cursor: pointer;
    border-color: rgba(78, 168, 222, 0.3);
    background: rgba(78, 168, 222, 0.03);
}

.feature-card.clickable-card:hover {
    border-color: #4EA8DE;
    background: rgba(78, 168, 222, 0.08);
    transform: translateY(-2px);
}

.feature-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.05rem;
    color: #4EA8DE;
    display: flex;
    align-items: center;
    gap: 6px;
}

.feature-card p {
    margin: 0;
    font-size: 0.9rem;
    color: #CBD5E1;
    line-height: 1.5;
}

/* --- Right Column: Chatbot Layout Structure --- */
.chatbot-column {
    width: 100%;
    height: 100%; /* Plays cleanly with the new flex layout window space */
}

.chatbot-box {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1C2541;
    border-radius: 24px;
    box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.chat-header {
    background: #111A36;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #FFFFFF;
}

.chat-header p {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: #4EA8DE;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

/* Message Wrapper Row Styles */
.message-row {
    display: flex;
    width: 100%;
    align-items: flex-end;
}

.message-row.bot-row {
    justify-content: flex-start;
}

.message-row.user-row {
    justify-content: flex-end;
}

/* Bot Profile Picture Avatar Circle */
.bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #4EA8DE;
    margin-right: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: #0B132B;
    background-image: url('../images/alice_profile.jpeg');
    background-size: cover;
    background-position: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Shared Bubble Logic */
.message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Left Aligned Bot styling adjustments */
.message.bot {
    background: rgba(255, 255, 255, 0.05);
    color: #F4F6F8;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Right Aligned User styling adjustments */
.message.user {
    background: #0076D6;
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

.message.system-error {
    background: rgba(239, 68, 68, 0.1);
    color: #FCA5A5;
    border: 1px solid rgba(239, 68, 68, 0.2);
    text-align: center;
    font-size: 0.85rem;
    max-width: 90%;
}

/* Typing Container Placement Adjustments */
.typing-row {
    display: none;
    align-items: flex-end;
    width: 100%;
}

.typing-indicator {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #4EA8DE;
    border-radius: 50%;
    animation: bounce 1.3s infinite both;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

.chat-footer {
    padding: 16px;
    background: #111A36;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
    background: #0B132B;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    color: #FFFFFF;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #4EA8DE;
}

.send-btn {
    background: #0076D6;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #005FA3;
}

/* Mobile Responsive Toggles */
@media (max-width: 968px) {
    html, body {
        height: auto;
    }
    .user-bar {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .logout-btn {
        width: 100%;
        justify-content: center;
    }
    .portal-container {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 24px 16px;
        height: auto;
    }
    .content-column {
        height: auto;
        overflow: visible;
        padding-right: 0;
    }
    .feature-grid {
        grid-template-columns: 1fr;
    }
    .chatbot-column {
        position: static;
        width: 100%;
        height: 600px;
    }
}