/* style.css - Premium Web Client Design System (Parvati Attire) */

:root {
    --primary: #800c2a;        /* Burgundy */
    --primary-hover: #63071e;  /* Darker Burgundy */
    --gold: #c5a059;           /* Gold accent */
    --bg-cream: #fcfaf8;       /* Ivory Soft */
    --bg-body: #f3ebea;        /* Warm background */
    --text-dark: #2e2325;      /* Charcoal text */
    --text-muted: #8e7a7d;     /* Muted burgundy-gray */
    --white: #ffffff;
    --success: #2ea44f;        /* Emerald Green */
    --border: #f3ebea;
    --shadow-sm: 0 2px 8px rgba(128, 12, 42, 0.04);
    --shadow-md: 0 8px 24px rgba(128, 12, 42, 0.08);
}

/* Reset & Basic Setup */
* {
    box-sizing: border-box;
}

body, html {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: var(--bg-body);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hidden { display: none !important; }

/* Responsive Container - Desktop looks like a premium Phone App, Mobile is Fullscreen */
.app-container {
    width: 100%;
    max-width: 480px;
    height: 100%;
    max-height: 100vh;
    background-color: var(--white);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(46, 35, 37, 0.15);
}

@media (min-width: 480px) {
    .app-container {
        height: 90vh;
        border-radius: 20px;
        overflow: hidden;
    }
}

/* ==================== 1. LOGIN SCREEN ==================== */
#loginView {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 24px;
    background: linear-gradient(135deg, var(--bg-cream) 0%, #f6eef0 100%);
    position: relative;
}

.login-container {
    width: 100%;
    max-width: 360px;
    background: var(--white);
    padding: 32px 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    text-align: center;
    border: 1px solid var(--border);
}

.login-logo {
    margin-bottom: 24px;
}

.login-logo h2 {
    margin: 0;
    font-size: 26px;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 1px;
}

.login-logo p {
    margin: 4px 0 0 0;
    font-size: 9px;
    color: var(--gold);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.login-container h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--bg-cream);
    transition: all 0.3s;
    margin-bottom: 20px;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(128, 12, 42, 0.08);
}

#loginBtn {
    width: 100%;
    padding: 14px;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#loginBtn:hover {
    background-color: var(--primary-hover);
}

#loginBtn:active {
    transform: scale(0.98);
}


/* ==================== 2. CHAT SCREEN ==================== */
#chatView {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background-color: var(--bg-cream);
}

/* Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background-color: var(--white);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    z-index: 5;
}

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

.menu-toggle-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#statusIndicator {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

#statusIndicator.connected {
    background-color: #d7f9e3;
    color: var(--success);
}

#statusIndicator.connecting {
    background-color: #fff3cd;
    color: #ff9800;
}

#statusIndicator.disconnected {
    background-color: #fde5e5;
    color: #dc3545;
}

/* Sidebar Drawer */
.sidebar {
    position: absolute;
    top: 0;
    left: -240px;
    width: 220px;
    height: 100%;
    background-color: var(--white);
    z-index: 20;
    box-shadow: 4px 0 24px rgba(46, 35, 37, 0.12);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
}

#closeSidebarBtn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

#closeSidebarBtn:hover {
    color: var(--primary);
}

.sidebar-section {
    padding: 16px;
    flex-shrink: 0;
}

.sidebar-section:last-child {
    flex-grow: 1;
    overflow-y: auto;
    border-top: 1px solid var(--border);
}

.sidebar-section h4 {
    margin: 0 0 10px 0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    font-weight: 700;
}

.channel-list, .user-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.channel-item {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-dark);
    transition: all 0.2s;
}

.channel-item:hover {
    background: var(--bg-cream);
    color: var(--primary);
}

.channel-item.active {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-dark);
}

.user-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
}

.user-room {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
    background: var(--bg-cream);
    padding: 2px 8px;
    border-radius: 12px;
    max-width: 65px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-users {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px;
    font-style: italic;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(46, 35, 37, 0.4);
    z-index: 15;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Chat Message Box */
#chatBox {
    flex-grow: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--bg-cream);
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 75%;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.msg-bubble .user {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 3px;
}

.msg-other {
    background-color: var(--white);
    color: var(--text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.msg-other .user {
    color: var(--primary);
}

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

.msg-my .user {
    display: none; /* Hide own name in my bubble */
}

.msg-system {
    font-size: 11px;
    color: var(--text-muted);
    background-color: rgba(128, 12, 42, 0.04);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px dashed var(--primary);
    font-style: italic;
    text-align: center;
    align-self: center;
    max-width: 85%;
    box-shadow: none;
}

.msg-time {
    font-size: 9px;
    align-self: flex-end;
    margin-top: 4px;
    opacity: 0.6;
}

/* Chat Images */
.chat-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 10px;
    cursor: zoom-in;
    margin-top: 4px;
    transition: transform 0.2s;
    object-fit: cover;
}

.chat-img:hover {
    transform: scale(1.02);
}

/* Typing Indicator */
#typingIndicator {
    padding: 6px 18px;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    height: 20px;
    flex-shrink: 0;
}

/* Emoji Picker Drawer */
#emojiPicker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    padding: 12px;
    background: var(--white);
    border-top: 1px solid var(--border);
    max-height: 140px;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 5;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background-color 0.1s;
}

.emoji-btn:hover {
    background-color: var(--bg-cream);
}

/* Input Bar & Toolbar Area */
.input-container {
    padding: 12px 16px;
    background-color: var(--white);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.toolbar {
    display: flex;
    gap: 12px;
}

.tool-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.tool-btn:hover {
    background-color: var(--bg-cream);
}

.input-row {
    display: flex;
    gap: 10px;
}

#messageInput {
    flex-grow: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    background-color: var(--bg-cream);
    color: var(--text-dark);
    transition: all 0.2s;
    resize: none;
    height: 44px;
    box-sizing: border-box;
}

#messageInput:focus {
    outline: none;
    background-color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(128, 12, 42, 0.06);
}

#messageInput:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#sendBtn {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

#sendBtn:hover {
    background-color: var(--primary-hover);
}

#sendBtn:disabled {
    background-color: #e5dada;
    color: #a89496;
    cursor: not-allowed;
}

#sendBtn:active:not(:disabled) {
    transform: scale(0.95);
}

/* ==================== 3. IMAGE MODAL ZOOM ==================== */
#imageModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(46, 35, 37, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

#modalImg {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    object-fit: contain;
}

#closeModalBtn {
    margin-top: 18px;
    padding: 10px 24px;
    background-color: var(--white);
    color: var(--primary);
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: background-color 0.2s, transform 0.1s;
}

#closeModalBtn:hover {
    background-color: var(--bg-cream);
    transform: scale(1.05);
}