/*
 * DIASPORA.RO — Chat System CSS v3.0
 * Chat cu transfer fișiere, camere, mesaje private
 * © 2025 diaspora.ro | Creat de Cosmin
 */

/* =====================================================
   CHAT PAGE LAYOUT
   ===================================================== */
.delia-chat-page {
    display: flex;
    height: calc(100vh - var(--d-header-h));
    background: var(--d-bg);
    overflow: hidden;
}

/* Left Sidebar */
.delia-chat-left {
    width: 320px;
    background: var(--d-bg-card);
    border-right: 1px solid var(--d-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.delia-chat-left-header {
    padding: 20px;
    border-bottom: 1px solid var(--d-border);
}

.delia-chat-left-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--d-text);
    margin-bottom: 12px;
}

.delia-chat-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--d-bg-subtle);
    border: 1px solid var(--d-border);
    border-radius: 99px;
    padding: 8px 16px;
    transition: all 0.2s;
}
.delia-chat-search:focus-within {
    border-color: var(--d-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.delia-chat-search input {
    background: none;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--d-text);
    flex: 1;
    font-family: inherit;
}
.delia-chat-search input::placeholder { color: var(--d-text-light); }

/* Room Tabs */
.delia-chat-tabs {
    display: flex;
    padding: 8px 12px 0;
    gap: 4px;
    border-bottom: 1px solid var(--d-border);
}
.delia-chat-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--d-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
}
.delia-chat-tab.active {
    color: var(--d-primary);
    border-bottom-color: var(--d-primary);
}
.delia-chat-tab:hover { color: var(--d-text); }

/* Room List */
.delia-chat-room-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.delia-chat-room-list::-webkit-scrollbar { width: 4px; }
.delia-chat-room-list::-webkit-scrollbar-thumb {
    background: var(--d-border);
    border-radius: 2px;
}

.delia-room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--d-radius);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    margin-bottom: 2px;
}
.delia-room-item:hover { background: var(--d-bg-subtle); }
.delia-room-item.active { background: rgba(37,99,235,0.1); }
.delia-room-item.active .delia-room-item-name { color: var(--d-primary); }

.delia-room-item-icon {
    width: 46px; height: 46px;
    border-radius: var(--d-radius);
    background: var(--d-bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    position: relative;
}
.delia-room-online-dot {
    position: absolute;
    bottom: -2px; right: -2px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid var(--d-bg-card);
}

.delia-room-item-info { flex: 1; min-width: 0; }
.delia-room-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--d-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.delia-room-item-preview {
    font-size: 12px;
    color: var(--d-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.delia-room-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.delia-room-item-time {
    font-size: 11px;
    color: var(--d-text-light);
}
.delia-room-item-badge {
    background: var(--d-primary);
    color: #fff;
    border-radius: 99px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
}

/* =====================================================
   CHAT MAIN AREA
   ===================================================== */
.delia-chat-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.delia-chat-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--d-bg-card);
    border-bottom: 1px solid var(--d-border);
    flex-shrink: 0;
}
.delia-chat-topbar-icon {
    width: 42px; height: 42px;
    border-radius: var(--d-radius);
    background: var(--d-bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.delia-chat-topbar-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--d-text);
}
.delia-chat-topbar-status {
    font-size: 12px;
    color: var(--d-success);
    display: flex;
    align-items: center;
    gap: 4px;
}
.delia-chat-topbar-status::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--d-success);
    display: inline-block;
}
.delia-chat-topbar-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}
.delia-chat-action-btn {
    width: 38px; height: 38px;
    border-radius: var(--d-radius);
    border: none;
    background: none;
    color: var(--d-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.delia-chat-action-btn:hover {
    background: var(--d-bg-subtle);
    color: var(--d-text);
}

/* Messages Area */
.delia-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.delia-messages-area::-webkit-scrollbar { width: 4px; }
.delia-messages-area::-webkit-scrollbar-thumb {
    background: var(--d-border);
    border-radius: 2px;
}

/* Date divider */
.delia-date-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 12px;
}
.delia-date-divider::before,
.delia-date-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--d-border);
}
.delia-date-divider span {
    font-size: 11px;
    font-weight: 600;
    color: var(--d-text-light);
    white-space: nowrap;
    padding: 4px 12px;
    background: var(--d-bg-subtle);
    border-radius: 99px;
}

/* Message bubbles */
.delia-msg-group {
    display: flex;
    gap: 10px;
    max-width: 75%;
    margin-bottom: 2px;
}
.delia-msg-group.self {
    flex-direction: row-reverse;
    margin-left: auto;
}
.delia-msg-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    align-self: flex-end;
}
.delia-msg-content { display: flex; flex-direction: column; gap: 2px; }
.delia-msg-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--d-text-muted);
    margin-bottom: 4px;
    padding-left: 4px;
}
.delia-msg-bubble {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 18px 18px 18px 4px;
    background: var(--d-bg-subtle);
    border: 1px solid var(--d-border);
    font-size: 14px;
    color: var(--d-text);
    line-height: 1.5;
    word-break: break-word;
    max-width: 100%;
}
.delia-msg-group.self .delia-msg-bubble {
    background: var(--d-primary);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    border-color: transparent;
}
.delia-msg-time {
    font-size: 11px;
    color: var(--d-text-light);
    padding: 0 4px;
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 4px;
}
.delia-msg-group.self .delia-msg-time { align-self: flex-start; }

/* File message */
.delia-msg-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--d-bg-subtle);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    max-width: 280px;
}
.delia-msg-file:hover {
    background: rgba(37,99,235,0.08);
    border-color: rgba(37,99,235,0.3);
}
.delia-msg-group.self .delia-msg-file {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
}
.delia-msg-file-icon { font-size: 32px; flex-shrink: 0; }
.delia-msg-file-info { flex: 1; min-width: 0; }
.delia-msg-file-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--d-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.delia-msg-group.self .delia-msg-file-name { color: rgba(255,255,255,0.9); }
.delia-msg-file-size {
    font-size: 12px;
    color: var(--d-text-muted);
}
.delia-msg-group.self .delia-msg-file-size { color: rgba(255,255,255,0.6); }

/* Image message */
.delia-msg-image {
    border-radius: 12px;
    max-width: 300px;
    max-height: 300px;
    object-fit: cover;
    cursor: pointer;
    transition: all 0.2s;
}
.delia-msg-image:hover { opacity: 0.9; transform: scale(1.01); }

/* =====================================================
   TYPING INDICATOR
   ===================================================== */
.delia-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    opacity: 0;
    transition: opacity 0.3s;
}
.delia-typing.visible { opacity: 1; }
.delia-typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: var(--d-bg-subtle);
    border-radius: 18px;
    border: 1px solid var(--d-border);
}
.delia-typing-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--d-text-light);
    animation: typingDot 1.4s infinite;
}
.delia-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.delia-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40%            { transform: scale(1.1); opacity: 1; }
}
.delia-typing-text {
    font-size: 12px;
    color: var(--d-text-muted);
    font-style: italic;
}

/* =====================================================
   INPUT BAR
   ===================================================== */
.delia-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: var(--d-bg-card);
    border-top: 1px solid var(--d-border);
    flex-shrink: 0;
}

.delia-input-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.delia-input-action-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: none;
    background: none;
    color: var(--d-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.delia-input-action-btn:hover {
    background: var(--d-bg-subtle);
    color: var(--d-primary);
}

.delia-input-wrapper {
    flex: 1;
    background: var(--d-bg-subtle);
    border: 1px solid var(--d-border);
    border-radius: 20px;
    padding: 10px 16px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    transition: all 0.2s;
    min-height: 44px;
}
.delia-input-wrapper:focus-within {
    border-color: var(--d-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.delia-message-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--d-text);
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
}
.delia-message-input::placeholder { color: var(--d-text-light); }

.delia-send-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--d-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
.delia-send-btn:hover {
    background: var(--d-primary-dark);
    transform: scale(1.05);
}
.delia-send-btn:active { transform: scale(0.95); }

/* File upload overlay */
.delia-drop-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(37,99,235,0.15);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    border: 4px dashed var(--d-primary);
}
.delia-drop-overlay.active { display: flex; }
.delia-drop-content {
    text-align: center;
    color: var(--d-primary);
    font-size: 20px;
    font-weight: 700;
}
.delia-drop-icon { font-size: 64px; margin-bottom: 16px; }

/* =====================================================
   RIGHT SIDEBAR (Members)
   ===================================================== */
.delia-chat-right {
    width: 260px;
    background: var(--d-bg-card);
    border-left: 1px solid var(--d-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.delia-chat-right-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--d-border);
    font-size: 14px;
    font-weight: 700;
    color: var(--d-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.delia-members-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.delia-member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--d-radius);
    cursor: pointer;
    transition: all 0.2s;
}
.delia-member-item:hover { background: var(--d-bg-subtle); }
.delia-member-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    position: relative;
    flex-shrink: 0;
}
.delia-member-status {
    position: absolute;
    bottom: -1px; right: -1px;
    width: 11px; height: 11px;
    border-radius: 50%;
    border: 2px solid var(--d-bg-card);
    background: var(--d-text-light);
}
.delia-member-status.online   { background: #10b981; }
.delia-member-status.away     { background: #f59e0b; }
.delia-member-status.busy     { background: #ef4444; }
.delia-member-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--d-text);
}
.delia-member-role {
    font-size: 11px;
    color: var(--d-text-muted);
    margin-top: 1px;
}
.delia-member-country { font-size: 16px; margin-left: auto; }

/* =====================================================
   EMOJI PICKER (simple)
   ===================================================== */
.delia-emoji-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--d-bg-card);
    border: 1px solid var(--d-border);
    border-radius: var(--d-radius-lg);
    padding: 12px;
    width: 300px;
    box-shadow: var(--d-shadow-xl);
    z-index: 100;
    display: none;
}
.delia-emoji-picker.visible { display: block; }
.delia-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}
.delia-emoji-btn {
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    border: none;
    background: none;
    transition: all 0.15s;
    text-align: center;
}
.delia-emoji-btn:hover { background: var(--d-bg-subtle); transform: scale(1.2); }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1200px) {
    .delia-chat-right { display: none; }
}
@media (max-width: 900px) {
    .delia-chat-left { width: 72px; }
    .delia-chat-left-header, .delia-room-item-info, .delia-room-item-meta,
    .delia-chat-left-title, .delia-chat-search, .delia-chat-tabs { display: none; }
    .delia-room-item-icon { margin: auto; }
}
@media (max-width: 640px) {
    .delia-chat-left  { display: none; }
    .delia-msg-group  { max-width: 90%; }
}
