/* ========================================
   CHAT SLATE THEME - GLASSMORPHISM
   Based on Admin Template
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Slate Palette */
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    
    /* Semantic Colors */
    --primary-blue: #3b82f6;
    --success-green: #22c55e;
    --danger-red: #ef4444;
    --warning-yellow: #eab308;
    
    /* Glassmorphism Variables */
    --bg-gradient: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 50%, var(--slate-900) 100%);
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-bg-hover: rgba(51, 65, 85, 0.4);
    --glass-border: rgba(51, 65, 85, 0.5);
    --glass-blur: blur(16px);
    
    /* Layout */
    --sidebar-width: 320px;
    --header-height: 70px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
}

/* Base Reset */
body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

/* Layout */
.chat-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.chat-sidebar {
    width: var(--sidebar-width);
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.sidebar-user-info { flex: 1; }

.sidebar-user-name {
    font-weight: 600;
    font-size: 1rem;
    color: white;
}

.sidebar-user-status {
    font-size: 0.8rem;
    color: var(--success-green);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-search input {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 10px 16px;
    color: white;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--slate-500);
    background: rgba(15, 23, 42, 0.6);
}

/* Chat List */
.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    margin-bottom: 4px;
}

.chat-item:hover {
    background: var(--glass-bg-hover);
}

.chat-item.active {
    background: rgba(59, 130, 246, 0.15); /* Primary blue transparent */
    border-color: rgba(59, 130, 246, 0.3);
}

.chat-item-avatar .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--slate-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 1.2rem;
    border: 2px solid var(--slate-600);
}

.chat-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chat-item-content {
    flex: 1;
    min-width: 0; /* for truncation */
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-item-title {
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 0.75rem;
    color: var(--slate-400);
}

.chat-item-message {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-item-preview {
    font-size: 0.85rem;
    color: var(--slate-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.badge-notification {
    background: var(--primary-blue);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.4);
    position: relative;
}

/* Chat Header */
.chat-header {
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-header-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.chat-header-subtitle {
    font-size: 0.8rem;
    color: var(--slate-400);
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-400);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message-wrapper {
    display: flex;
    margin-bottom: 8px;
    flex-direction: column; /* Allow content stacking */
    max-width: 60%; /* Limit message width */
}

.message-wrapper.sent {
    align-self: flex-end; /* Align sent messages to right */
    align-items: flex-end;
}

.message-wrapper.received {
    align-self: flex-start; /* Align received messages to left */
    align-items: flex-start;
}

.message-bubble {
    width: auto;
    min-width: 120px;
    padding: 12px 16px 28px 16px; /* Padding for content + time */
    border-radius: 18px;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message-wrapper.received .message-bubble {
    background: #334155; /* Dark grey for received */
    color: white;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-wrapper.sent .message-bubble {
    background: #475569; /* Lighter grey for sent */
    color: white;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sender Name - Outside Bubble */
.message-sender-name {
    font-size: 0.75rem;
    color: var(--slate-400);
    margin-bottom: 4px;
    margin-left: 4px;
}

/* Message Time - Inside Bubble Bottom Right */
.message-time-inside {
    position: absolute;
    bottom: 6px;
    right: 12px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Message Header & Content - Reset */
.message-header {
    display: none; /* Hide old header inside bubble */
}

.message-text {
    word-wrap: break-word;
}

/* Message Actions - Absolute Positioned */
.message-actions {
    position: absolute;
    top: -30px; /* Show actions above message on hover */
    right: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: all 0.2s ease;
    background: rgba(15, 23, 42, 0.8);
    padding: 4px 6px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.message-wrapper:hover .message-actions {
    opacity: 1;
    pointer-events: auto;
}

.message-wrapper.received .message-actions {
    left: 0;
    right: auto;
}

.message-action-btn {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.message-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.1);
}

.message-action-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.message-info {
    font-size: 0.7rem;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

.message-sender {
    font-size: 0.75rem;
    margin-bottom: 4px;
    color: var(--slate-400);
    margin-left: 12px;
}

/* Enhanced Input Area Styles */
.chat-input {
    padding: 20px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--glass-border);
}

.chat-input-box {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-input-box textarea {
    background: transparent;
    border: none;
    color: white;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    min-height: 40px;
    outline: none;
    width: 100%;
}

.chat-toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--glass-border);
    padding-top: 8px;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.format-btn, .action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
    transition: all 0.2s;
}

.format-btn:hover, .action-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.tool-separator {
    width: 1px;
    height: 20px;
    background: var(--glass-border);
    margin: 0 8px;
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 8px;
}

.send-btn:hover {
    background: var(--slate-500);
}

/* Scrollbar */
::-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); }

/* Emoji Styling - Global in Chat */
.emoji, 
.message-text img,
.message-bubble img[src*="fluent-cdn"],
img.emoji {
    height: 3.5em !important; /* Force larger size */
    width: 3.5em !important;
    margin: 0 0.15em;
    vertical-align: middle !important;
    display: inline-block;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    object-fit: contain !important;
    max-width: none !important; /* Prevent constraints */
}

.emoji:hover,
.message-text img:hover,
.message-bubble img[src*="fluent-cdn"]:hover {
    transform: scale(1.2);
}

/* Jumbomoji (Single Emoji Messages) */
.message-text:only-child .emoji:only-child,
.message-text:only-child img:only-child,
.message-text:only-child img[src*="fluent-cdn"]:only-child {
    height: 6em !important;
    width: 6em !important;
}

/* ========================================
   EMOJI PICKER
   ======================================== */
.emoji-picker-container {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    width: 400px; /* Even Wider */
    max-height: 500px; /* Taller */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.emoji-picker-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.8);
}

.emoji-search {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 1.1rem; /* Larger text */
    outline: none;
    transition: all 0.2s;
}

.emoji-search:focus {
    border-color: var(--primary-blue);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.emoji-grid {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 64px); /* Fixed width columns for consistency */
    gap: 8px;
    overflow-y: auto;
    max-height: 400px;
    justify-content: center; /* Center the grid */
}

.emoji-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    width: 64px; /* Explicit width */
    height: 64px; /* Explicit height */
    padding: 4px; /* Minimal padding */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 40px; /* For text fallback */
}

.emoji-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.1);
    z-index: 10;
}

/* Force emoji size inside picker */
.emoji-btn img,
.emoji-btn .picker-emoji {
    width: 100% !important; /* Fill the button */
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    display: block !important;
    object-fit: contain !important;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    margin: 0 !important;
    padding: 0 !important;
}

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

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .chat-layout { position: relative; }
    .chat-sidebar {
        position: absolute;
        left: 0; top: 0; bottom: 0;
        width: 85%;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }
    .chat-sidebar.active { transform: translateX(0); }
    .chat-main { width: 100%; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 90;
    }
    .sidebar-overlay.active { display: block; }
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--slate-400);
    text-align: center;
    height: 100%;
    width: 100%;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 20px;
}

.welcome-icon { font-size: 4rem; margin-bottom: 20px; opacity: 0.5; }
.welcome-text { font-size: 1.5rem; font-weight: 600; color: white; }

/* Right Sidebar */
.chat-info {
    width: 280px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: var(--glass-blur);
    border-left: 1px solid var(--glass-border);
    display: none; /* Toggled via JS */
    flex-direction: column;
}

.chat-info.active { display: flex; }

/* Right Sidebar Content */
.chat-info-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.group-header {
    text-align: center;
    margin-bottom: 24px;
}

.group-avatar {
    margin: 0 auto 12px;
    width: 80px;
    height: 80px;
    font-size: 2rem;
    background: linear-gradient(135deg, var(--slate-700), var(--slate-800));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.1);
}

.group-name {
    margin: 0 0 4px;
    font-size: 1.2rem;
    font-weight: 600;
}

.group-description {
    margin: 0;
    font-size: 0.85rem;
    color: var(--slate-400);
}

/* Info Sections */
.info-section {
    margin-bottom: 20px;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.info-section-title {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
    color: var(--slate-300);
}

.info-content {
    padding: 12px;
}

/* Textareas in Right Sidebar */
.info-textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    min-height: 80px;
    resize: vertical;
    outline: none;
    transition: all 0.2s;
}

.info-textarea:focus {
    border-color: var(--primary-blue);
    background: rgba(15, 23, 42, 0.8);
}

/* Buttons in Right Sidebar */
.info-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-save {
    background: var(--primary-blue);
    color: white;
}

.btn-save:hover {
    background: #2563eb;
}

.btn-clear {
    background: transparent;
    color: var(--slate-400);
    border: 1px solid var(--glass-border);
}

.btn-clear:hover {
    color: var(--danger-red);
    border-color: var(--danger-red);
    background: rgba(239, 68, 68, 0.1);
}

/* Logout Button & General Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--slate-300);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

/* Members List */
.member-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.member-item:last-child {
    border-bottom: none;
}

/* ========================================
   FILE UPLOAD PREVIEW
   ======================================== */
.file-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.file-upload-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    max-width: 250px;
}

.file-upload-preview .file-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-upload-preview .file-info {
    flex: 1;
    min-width: 0;
}

.file-upload-preview .file-name {
    font-size: 0.85rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-upload-preview .file-size {
    font-size: 0.75rem;
    color: var(--slate-400);
}

.file-preview-remove {
    background: rgba(239, 68, 68, 0.2);
    border: none;
    color: #FCA5A5;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    margin-left: 8px;
}

.file-preview-remove:hover {
    background: rgba(239, 68, 68, 0.4);
    transform: scale(1.1);
}

.file-preview-remove svg {
    width: 14px;
    height: 14px;
}

/* ========================================
   LOGIN PAGE STYLES
   ======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: var(--spacing-lg);
    background: var(--bg-gradient);
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.login-logo {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.login-logo img {
    height: 60px;
    width: auto;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--slate-400);
}

.login-form {
    position: relative;
    z-index: 1;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--slate-300);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    padding-right: 3rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    background: rgba(15, 23, 42, 0.8);
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-control::placeholder {
    color: var(--slate-500);
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.5;
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--slate-300);
    font-size: 0.9rem;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.forgot-password {
    color: var(--primary-blue);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-password:hover {
    color: #60a5fa;
}

.login-submit {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-blue);
    border: none;
    border-radius: var(--radius-xl);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.login-submit:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.login-submit:active {
    transform: translateY(0);
}

.login-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--slate-500);
    font-size: 0.85rem;
}

.login-version {
    margin-top: 8px;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideDown 0.3s ease-out;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

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

/* Particles */
.particles {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: float-particle 20s infinite ease-in-out;
}

@keyframes float-particle {
    0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.3; }
    50% { transform: translate(100px, -100px) rotate(180deg); opacity: 0.6; }
}

/* ========================================
   LOGIN BACKGROUND OVERLAY
   ======================================== */
.login-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.login-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.4;
}

.login-background.gradient-animate {
    background: linear-gradient(-45deg, #0f172a, #1e293b, #334155, #0f172a);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ========================================
   MISSING MODAL & ACTION STYLES (Restored)
   ======================================== */

/* Confirm Modal */
.confirm-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.confirm-modal {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.confirm-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 20px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.confirm-btn-danger {
    background: #ef4444;
    color: white;
}

.confirm-btn:hover { transform: translateY(-2px); }

/* Reply Preview Bar */
.reply-preview-bar {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    background: rgba(30, 41, 59, 0.95);
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--slate-300);
    z-index: 5;
    backdrop-filter: blur(10px);
    border-radius: 16px 16px 0 0;
}

/* Message Actions Fix */
.message-actions {
    position: absolute;
    top: -35px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: all 0.2s ease;
    background: #1e293b;
    padding: 4px 6px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    pointer-events: none;
}

.message-wrapper:hover .message-actions {
    opacity: 1;
    pointer-events: auto;
}

/* Ensure bubbles don't clip actions */
.message-bubble {
    overflow: visible !important;
}

/* Edited Badge */
.edited-badge {
    font-size: 0.7em;
    font-style: italic;
    opacity: 0.7;
    margin-left: 4px;
}

/* ========================================
   LIGHTBOX / MODAL IMAGE PREVIEW
   ======================================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   MARKDOWN STYLING
   ======================================== */
.message-text p {
    margin: 0 0 0.5em 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text strong {
    font-weight: 700;
    color: inherit;
}

.message-text em {
    font-style: italic;
    color: inherit;
}

.message-text ul, .message-text ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message-text li {
    margin-bottom: 0.25em;
}

.message-text blockquote {
    margin: 0.5em 0;
    padding-left: 1em;
    border-left: 3px solid rgba(255, 255, 255, 0.3);
    opacity: 0.8;
}

.message-text code {
    font-family: monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.1em 0.3em;
    border-radius: 4px;
    font-size: 0.9em;
}

.message-text pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.message-text pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.message-text a {
    color: #60a5fa; /* Light blue for links */
    text-decoration: underline;
}

.message-text h1, .message-text h2, .message-text h3 {
    margin: 0.5em 0;
    font-size: 1.1em;
    font-weight: 700;
}

/* ========================================
   LIGHTBOX STYLING
   ======================================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: transparent;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 100001;
    transition: transform 0.2s;
}

.lightbox-close:hover {
    transform: scale(1.1);
    color: #ef4444;
}
