﻿/* --- GLOBAL THEME --- */
body {
    background-color: #e0eafc;
    background-image: linear-gradient(160deg, #e0eafc 0%, #cfdef3 100%);
    font-family: 'Poppins', sans-serif;
    color: #4a4a4a;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Hide Default Footer for a cleaner App look */
footer {
    display: none !important;
}

/* --- DASHBOARD LAYOUT (Split View) --- */
.app-container {
    display: grid;
    grid-template-columns: 350px 1fr; 
    gap: 25px;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    height: 85vh; 
}

/* --- GLASS PANEL STYLES --- */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- LEFT PANEL: CONTROL CENTER --- */
.control-panel {
    padding: 30px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,0.6));
}

.panel-header {
    margin-bottom: 30px;
    text-align: center;
}

.panel-header h5 {
    font-weight: 600;
    color: #333;
    margin: 0;
    font-size: 1.2rem;
}

.panel-header small {
    color: #777;
    font-size: 0.8rem;
}

/* Custom Input Styling with Icons */
.input-group-custom {
    margin-bottom: 20px;
    position: relative;
}

.input-group-custom label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #5f6c7b;
    margin-bottom: 8px;
    margin-left: 5px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a29bfe;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 12px 15px 12px 45px; 
    border: 1px solid #e1e1e1;
    background-color: #f9f9f9;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    color: #333;
}

    input[type="text"]:focus, input[type="password"]:focus {
        background-color: #ffffff;
        border-color: #a29bfe;
        box-shadow: 0 4px 12px rgba(162, 155, 254, 0.2);
        outline: none;
    }

/* Action Buttons Area */
.action-area {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

input[type="button"] {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

    input[type="button"]:hover {
        transform: translateY(-2px);
    }

/* Specific Gradients */
#btnGetBearer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#btnInit {
    background: linear-gradient(135deg, #2af598 0%, #009efd 100%);
}

#btnLogin {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

#btnConnectHub {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    color: #555;
}

#btnSendMsg {
    background: linear-gradient(135deg, #fad0c4 0%, #ffd1ff 100%);
    color: #555;
}

#btnUninit {
    background: #ff5f56;
    margin-top: 10px;
}


/* --- RIGHT PANEL: CHAT HUB --- */
.chat-panel {
    display: flex;
    flex-direction: column;
}

/* Tab Header Styled as Top Navigation */
.tab-header {
    display: flex;
    background: rgba(240, 242, 245, 0.5);
    padding: 10px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.tab-btn {
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    color: #888;
    border-radius: 8px;
    transition: all 0.3s;
    margin-right: 10px;
    font-size: 0.9rem;
}

.tab-btn:hover {
    background: rgba(0,0,0,0.05);
}

.tab-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tab-content {
    flex-grow: 1;
    display: none;
    position: relative;
    background: white;
    height: 100%; 
    overflow: hidden;
    min-height: 0;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* System Log styling */
#messagesList {
    height: 100%;
    width: 100%;
    border: none;
    padding: 20px;
    margin: 0;
    background: #1e1e1e; /* Terminal Black */
    color: #00ff9d;
    font-family: 'Consolas', monospace;
    overflow-y: auto;
    list-style: none;
}

#messagesList li {
    border-bottom: 1px dashed #333;
    padding: 5px 0;
}

/* Live Chat Styling */
/*#messagesList2 {
    height: 100%;
    width: 100%;
    border: none;
    padding: 20px;
    margin: 0;
    background: #f0f2f5;
    overflow-y: auto;
    list-style: none;
    display: block;
}*/
#messagesList2 {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px !important;
    background-color: #e5ddd5;
    /* --- ADD THESE 3 LINES --- */
    overflow-y: auto; /* Enables the vertical scrollbar */
    height: 100%; /* Forces it to fill the container height */
    flex-grow: 1; /* Ensures it expands to fit the flex container */
}

/*#messagesList2 li {
    border-bottom: 1px solid rgba(0,0,0,0.05); 
    padding: 8px 0;
    color: #333;
    font-size: 0.95rem;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}*/
    #messagesList2 li {
        border-bottom: none !important; /* Remove the old separator lines */
        padding: 0 !important;
        background: transparent !important;
        width: 100%;
        display: flex;
    }

/* Message Bubble Container */
.msg-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

/* --- RECEIVED MESSAGES (Left) --- */
.msg-row-received {
    justify-content: flex-start;
}

    .msg-row-received .msg-bubble {
        background-color: #ffffff;
        color: #303030;
        border-top-left-radius: 0; /* Corner accent */
    }

/* --- SENT MESSAGES (Right) --- */
.msg-row-sent {
    justify-content: flex-end;
}

    .msg-row-sent .msg-bubble {
        background-color: #dcf8c6; /* WhatsApp Green */
        color: #303030;
        border-top-right-radius: 0; /* Corner accent */
    }

/* Timestamp styling inside bubble */
.msg-time {
    display: block;
    font-size: 0.65rem;
    color: rgba(0,0,0,0.45);
    text-align: right;
    margin-top: 4px;
}

/* Mobile Responsive adjustment */
@@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .glass-panel {
        height: 500px;
    }
}

/* --- PASSWORD TOGGLE FIXES --- */

/* 1. Hide Microsoft Edge/IE default password reveal button */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

input[type="password"] {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 15px;
    left: auto !important;
    top: 50%;
    transform: translateY(-50%);
    color: #a29bfe;
    cursor: pointer;
    z-index: 10;
}

.password-toggle:hover {
    color: #667eea;
}
