/* 
  QOLEK Enterprise Design System (Unified)
  Colors: Professional Navy/Slate (#0f172a), Vibrant Indigo (#6366f1), Clear White (#f8fafc)
  Style: Sleek Enterprise Modern
*/

:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: #334155;
    --danger: #ef4444;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
}

.hidden { display: none !important; }

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* --- Authentication Screens --- */
.auth-container {
    width: 400px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.5s ease-out;
}

.auth-container h1 {
    font-size: 2rem;
    margin-bottom: 30px;
}

/* --- App Layout (Messaging) --- */
#app {
    width: 95vw;
    height: 90vh;
    max-width: 1200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
}

header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
}

header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

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

/* Premium Drag & Drop Overlay */
#drop-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(10, 15, 28, 0.85);
    backdrop-filter: blur(25px);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    border: 2px solid rgba(99, 102, 241, 0.3);
}

#drop-overlay.active {
    opacity: 1;
    visibility: visible;
}

.drop-content {
    text-align: center;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

#drop-overlay.active .drop-content {
    transform: translateY(0);
}

.drop-icon-wrapper {
    width: 140px; height: 140px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    position: relative;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.drop-icon-wrapper::after {
    content: '';
    position: absolute; inset: -15px;
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: 50px;
    animation: rotate 15s linear infinite;
}

@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.drop-icon-wrapper svg {
    width: 60px; height: 60px;
    color: var(--accent);
    filter: drop-shadow(0 0 15px var(--accent));
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.drop-title {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.drop-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
}

/* --- Profile Overlay --- */
#profile-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-panel-v2 {
    width: 320px;
    height: 100%;
    background: #1e293b;
    border-left: 1px solid var(--border-color);
    padding: 40px 25px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    transform: translateX(100%);
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#profile-overlay.active .profile-panel-v2 {
    transform: translateX(0);
}

/* --- Chat Area --- */
#chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

#chat-area::-webkit-scrollbar { width: 4px; }
#chat-area::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }

.message {
    max-width: 80%;
    position: relative;
    animation: messageIn 0.3s ease-out;
}

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

.msg-bubble {
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    background: rgba(51, 65, 85, 0.5);
    color: #fff;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
}

.message.incoming { align-self: flex-start; }
.message.incoming .msg-bubble { border-bottom-left-radius: 4px; }

.message.outgoing { align-self: flex-end; }
.message.outgoing .msg-bubble { border-bottom-right-radius: 4px; border-color: rgba(99, 102, 241, 0.3); }

.msg-meta { font-size: 0.7rem; color: var(--text-secondary); margin-top: 6px; display: flex; align-items: center; gap: 8px; }

/* --- Input Area --- */
.input-panel-v2 {
    padding: 20px 30px;
    background: rgba(15, 23, 42, 0.6);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
    align-items: center;
}

.input-container { flex: 1; }

.input-field {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: #fff;
    outline: none;
    transition: 0.2s;
}

.input-field:focus { border-color: var(--accent); background: #334155; }

/* --- Buttons & Icons --- */
.btn, .chat-btn, .icon-btn-v2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    border: none;
    outline: none;
}

.btn { padding: 12px 24px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; gap: 8px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: rgba(255,255,255,0.05); color: #fff; border: 1px solid var(--border-color); }

.chat-btn, .icon-btn-v2 {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.chat-btn:hover, .icon-btn-v2:hover { background: rgba(255,255,255,0.1); color: var(--accent); border-color: var(--accent); }

/* --- File Attachments --- */
.file-attachment img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    margin-top: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* --- UI Utilities --- */
.hidden { display: none !important; }

#notification {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--accent);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(-200%);
    transition: 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 10000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

#notification.show { transform: translateY(0); }

/* Message Highlight for Reply Navigation */
.msg-highlight {
    animation: highlightFade 2s ease-out;
}

@keyframes highlightFade {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
    15% { box-shadow: 0 0 30px rgba(99, 102, 241, 0.6); border-color: var(--accent); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* --- Admin Panel Components --- */
.container { max-width: 1200px; margin: 0 auto; padding: 40px 20px; width: 100%; }
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 30px; }
.header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 16px 20px; color: var(--text-secondary); font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid var(--border-color); }
td { padding: 20px; border-bottom: 1px solid var(--border-color); }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.status-admin { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.status-user { background: rgba(148, 163, 184, 0.2); color: var(--text-secondary); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Fix huge image in chat */
.message.incoming .message-menu {
    left: 0;
    right: auto;
}

.message.outgoing .message-menu {
    right: 0;
    left: auto;
}

.message-menu {
    position: absolute;
    bottom: 25px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    z-index: 1000;
    width: 130px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.menu-item {
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
}

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

.reactions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.reaction-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: 0.2s;
}

.reaction-chip:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--accent); }
.reaction-chip.active { background: rgba(99, 102, 241, 0.2); border-color: var(--accent); }

.emoji-selector {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    position: absolute;
    bottom: 30px;
    z-index: 2000;
}

.emoji-opt {
    font-size: 1.25rem;
    cursor: pointer;
    transition: 0.2s;
    padding: 5px;
    border-radius: 8px;
}

.emoji-opt:hover { background: rgba(255, 255, 255, 0.1); transform: scale(1.2); }

.pinned-item {
    cursor: pointer;
    transition: 0.2s;
    padding: 0 5px;
    border-radius: 4px;
}
.pinned-item:hover { background: rgba(255,255,255,0.05); color: var(--accent); }

/* --- User Mentions --- */
#compose-modal:not(.hidden) {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(10, 15, 28, 0.75) !important; 
    backdrop-filter: blur(12px) !important; 
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10100 !important;
    transition: opacity 0.3s ease;
}

.compose-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 35px;
    border-radius: 28px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.6);
    animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.mention-list {
    position: absolute;
    bottom: 60px;
    left: 0;
    width: 250px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 2000;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.mention-item {
    padding: 10px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.mention-item:hover, .mention-item.active {
    background: var(--accent);
    color: white;
}

.mention-tag {
    color: var(--accent);
    font-weight: 800;
    background: rgba(99, 102, 241, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    border: 1px solid transparent;
}

.mention-tag:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.poll-container {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    margin-top: 10px;
    width: 320px;
    max-width: 100%;
}

.poll-option {
    margin-bottom: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: 0.3s;
}

.poll-option:hover { background: rgba(255, 255, 255, 0.1); }
.poll-option.voted { border: 1px solid var(--accent); background: rgba(99, 102, 241, 0.1); }

.poll-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(99, 102, 241, 0.2);
    z-index: 0;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.poll-info {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
}

.presence-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 5px #10b981;
    animation: pulse-green 2s infinite;
}

.status-dot.away { background: #f59e0b; }
.status-dot.offline { background: #94a3b8; }

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@media (max-width: 768px) {
    #app { width: 100vw; height: 100vh; border-radius: 0; }
    .profile-panel-v2 { width: 100%; }
}
