/* assets/css/style.css */
body { background: #0f172a; color: #e2e8f0; }
.glass { background: rgba(30, 41, 59, 0.8); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.05); }
.input-dark { background: rgba(2,6,23,0.5); border: 1px solid rgba(148,163,184,0.2); color: white; outline:none; }
.input-dark:focus { border-color: #6366f1; }
::-webkit-scrollbar { width: 8px; } 
::-webkit-scrollbar-track { background: #020617; } 
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

/* Sticky Notes Styles */
.sticky-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 50; /* სიდებარის დონეზე ან ზემოთ */
    pointer-events: none; /* რომ უკან კლიკი შეიძლებოდეს */
}

.sticky-note {
    position: absolute;
    width: 220px;
    min-height: 200px;
    box-shadow: 5px 10px 20px rgba(0,0,0,0.3);
    transition: transform 0.1s, box-shadow 0.2s;
    pointer-events: auto; /* ნოუთზე კლიკი მოსულა */
    border-radius: 0 0 10px 10px; /* ოდნავ მოხრილი */
}

.sticky-note:active {
    z-index: 100 !important;
    opacity: 0.95;
    transform: scale(1.02);
}

.sticky-header {
    cursor: grab;
    backdrop-filter: brightness(0.9);
}
.sticky-header:active { cursor: grabbing; }

.handwritten { 
    font-family: 'Courier New', Courier, monospace; 
    line-height: 1.4;
}

/* --- CHAT DESIGN STYLES --- */
.chat-bubble-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 80%;
    margin-bottom: 8px;
}
.chat-bubble-wrapper.sent {
    flex-direction: row-reverse;
    margin-left: auto;
}
.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.chat-bubble-wrapper.compact .chat-avatar { display: none; }
.chat-content {
    display: flex;
    flex-direction: column;
}
.chat-bubble-wrapper.sent .chat-content { align-items: flex-end; }
.chat-sender-name {
    font-size: 0.8rem;
    font-weight: bold;
    color: #cbd5e1;
    margin-bottom: 4px;
    margin-left: 12px;
}
.chat-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: #334155; /* default for received */
    color: #f1f5f9;
}
.chat-bubble-wrapper.sent .chat-bubble {
    background-color: #4f46e5; /* indigo-600 */
    border-bottom-right-radius: 4px;
}
.chat-bubble-wrapper.received .chat-bubble {
    background-color: #334155; /* slate-700 */
    border-bottom-left-radius: 4px;
}
.chat-time {
    font-size: 0.65rem;
    color: #64748b; /* slate-500 */
    margin-top: 6px;
    padding: 0 6px;
}
/* assets/css/style.css */
body { background: #0f172a; color: #e2e8f0; }
.glass { background: rgba(30, 41, 59, 0.8); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.05); }
.input-dark { background: rgba(2,6,23,0.5); border: 1px solid rgba(148,163,184,0.2); color: white; outline:none; }
.input-dark:focus { border-color: #6366f1; }
::-webkit-scrollbar { width: 8px; } 
::-webkit-scrollbar-track { background: #020617; } 
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

/* Sticky Notes Styles */
.sticky-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; }
.sticky-note { position: absolute; width: 220px; min-height: 200px; box-shadow: 5px 10px 20px rgba(0,0,0,0.3); transition: transform 0.1s, box-shadow 0.2s; pointer-events: auto; border-radius: 0 0 10px 10px; }
.sticky-note:active { z-index: 100 !important; opacity: 0.95; transform: scale(1.02); }
.sticky-header { cursor: grab; backdrop-filter: brightness(0.9); }
.sticky-header:active { cursor: grabbing; }
.handwritten { font-family: 'Courier New', Courier, monospace; line-height: 1.4; }

/* --- NEW & IMPROVED CHAT DESIGN --- */
.chat-bubble-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.chat-bubble-wrapper.sent {
    align-items: flex-end;
}
.chat-bubble-wrapper.received {
    align-items: flex-start;
}

.chat-message-container {
    display: flex;
    gap: 0.75rem;
    max-width: 75%;
}

.chat-bubble-wrapper.sent .chat-message-container {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
    margin-top: auto;
}

.chat-content-wrapper {
    display: flex;
    flex-direction: column;
}

.chat-bubble-wrapper.sent .chat-content-wrapper {
    align-items: flex-end;
}
.chat-bubble-wrapper.received .chat-content-wrapper {
    align-items: flex-start;
}

.chat-sender-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8; /* slate-400 */
    margin-bottom: 0.25rem;
}

.chat-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1.1rem;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 0.9rem;
    position: relative;
}

.chat-bubble-wrapper.sent .chat-bubble {
    background-color: #4f46e5; /* indigo-600 */
    color: white;
    border-bottom-right-radius: 0.375rem; /* rounded-md */
}

.chat-bubble-wrapper.received .chat-bubble {
    background-color: #334155; /* slate-700 */
    color: #f1f5f9; /* slate-100 */
    border-bottom-left-radius: 0.375rem; /* rounded-md */
}

.chat-time {
    font-size: 0.7rem;
    color: #64748b; /* slate-500 */
    margin-top: 0.3rem;
}

/* Compact style for private chat */
.private-chat-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}
.private-chat-wrapper.sent { align-items: flex-end; }
.private-chat-wrapper.received { align-items: flex-start; }
.private-chat-wrapper .chat-bubble {
    max-width: 90%;
    padding: 0.6rem 0.9rem;
}

/* --- TELEGRAM-STYLE CHAT REDESIGN --- */
.chat-bubble-wrapper { display: flex; flex-direction: column; margin-bottom: 1.25rem; }
.chat-bubble-wrapper.sent { align-items: flex-end; }
.chat-bubble-wrapper.received { align-items: flex-start; }
.chat-message-container { display: flex; gap: 0.75rem; max-width: 70%; align-items: flex-start; }
.chat-bubble-wrapper.sent .chat-message-container { flex-direction: row-reverse; }

.chat-avatar { width: 40px; height: 40px; border-radius: 9999px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; flex-shrink: 0; background-color: #334155; }
.chat-content-wrapper { display: flex; flex-direction: column; }
.chat-bubble-wrapper.sent .chat-content-wrapper { align-items: flex-end; }
.chat-bubble-wrapper.received .chat-content-wrapper { align-items: flex-start; }

.chat-bubble-header { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.3rem; margin-left: 0.2rem; }
.chat-sender-name { font-size: 0.9rem; font-weight: 700; color: #a5b4fc; /* indigo-300 */ }
.chat-bubble-header .chat-time { font-size: 0.7rem; color: #64748b; }

.chat-bubble { padding: 0.75rem 1rem; border-radius: 1.25rem; line-height: 1.6; word-wrap: break-word; font-size: 0.95rem; position: relative; }
.chat-bubble-wrapper.sent .chat-bubble { background-image: linear-gradient(to right, #6366f1, #818cf8); color: white; border-bottom-right-radius: 0.5rem; }
.chat-bubble-wrapper.received .chat-bubble { background-color: #1e293b; /* slate-800 */ color: #e2e8f0; border-bottom-left-radius: 0.5rem; }

/* Sent message "You" + timestamp */
.sent-by-info { text-align: right; width: 100%; font-size: 0.75rem; color: #94a3b8; margin-top: 0.3rem; padding-right: 0.5rem; }
.sent-by-info span { font-weight: 700; }

/* Compact style for private popup chat */
.private-chat-wrapper.sent { align-items: flex-end; }
.private-chat-wrapper.received { align-items: flex-start; }
.private-chat-wrapper { display: flex; flex-direction: column; margin-bottom: 0.5rem; }
.private-chat-wrapper .chat-bubble { max-width: 90%; padding: 0.6rem 0.9rem; font-size: 0.9rem; }
.private-chat-wrapper .chat-time { font-size: 0.65rem; color: #64748b; margin-top: 0.3rem; }

/* Typing indicator bubbles */
.typing-indicator span { display: inline-block; width: 8px; height: 8px; margin: 0 2px; background-color: #64748b; border-radius: 50%; animation: typing-anim 1.4s infinite; }
.typing-indicator span:nth-child(1) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.4s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.6s; }
@keyframes typing-anim { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* --- FINAL FIXED CHAT DESIGN --- */

/* Background Pattern */
#chat-area-background {
    background-color: #0b1120;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%231e293b' fill-opacity='0.4' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
}

/* Wrapper for each message row */
.chat-bubble-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    width: 100%;
}

/* Alignment logic */
.chat-bubble-wrapper.sent {
    align-items: flex-end; /* Align to right */
}
.chat-bubble-wrapper.received {
    align-items: flex-start; /* Align to left */
}

/* Container holding Avatar + Bubble */
.chat-message-container {
    display: flex;
    gap: 10px;
    max-width: 75%; /* Don't let it stretch too wide */
    align-items: flex-end; /* Align bubble bottom with avatar */
}

/* For SENT messages, push content to the right */
.chat-bubble-wrapper.sent .chat-message-container {
    flex-direction: row; /* Keep normal row direction */
    justify-content: flex-end; /* Push content to end */
}

/* Content inside (Name + Bubble + Time) */
.chat-content-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

/* Align text inside the wrapper */
.chat-bubble-wrapper.sent .chat-content-wrapper {
    align-items: flex-end;
}
.chat-bubble-wrapper.received .chat-content-wrapper {
    align-items: flex-start;
}

/* Avatars */
.chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
    background-color: #334155;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Sender Name */
.chat-sender-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #a5b4fc;
    margin-bottom: 4px;
    margin-left: 12px;
}

/* THE BUBBLE ITSELF */
.chat-bubble {
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: white;
    position: relative;
    word-wrap: break-word; /* Prevent long words breaking layout */
    word-break: break-word;
    width: fit-content; /* Critical fix for squashing */
    min-width: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Bubble Colors & Shapes */
.chat-bubble-wrapper.sent .chat-bubble {
    background: linear-gradient(135deg, #6366f1, #4f46e5); /* Indigo gradient */
    border-bottom-right-radius: 2px;
    text-align: left;
}
.chat-bubble-wrapper.received .chat-bubble {
    background-color: #1e293b; /* Slate 800 */
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255,255,255,0.05);
}

/* Timestamp inside/outside bubble logic */
.chat-time {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 5px;
    text-align: right;
    opacity: 0.8;
}

/* Sent "You" info */
.sent-by-info {
    text-align: right;
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 4px;
    padding-right: 4px;
}
.sent-by-info span { font-weight: bold; color: #94a3b8; }

/* Private Chat Popup Styles */
.private-chat-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}
.private-chat-wrapper.sent { align-items: flex-end; }
.private-chat-wrapper.received { align-items: flex-start; }
.private-chat-wrapper .chat-bubble {
    font-size: 0.9rem;
    padding: 8px 12px;
    max-width: 85%;
}
/* --- MESSENGER STYLE LAYOUT --- */

/* 1. Left Sidebar List Items (Fixed Layout) */
.user-list-item {
    display: flex !important; /* Force flex row */
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    margin-bottom: 4px;
    width: 100%;
}

.user-list-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.user-list-item.active {
    background-color: #4f46e5; /* Indigo active state */
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.user-list-item.active .user-name {
    color: white !important;
}

/* Avatar in sidebar */
.user-avatar-small {
    width: 40px;
    height: 40px;
    min-width: 40px; /* Prevent shrinking */
    border-radius: 10px;
    background: #334155;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    position: relative;
}

/* Online Status Dot */
.online-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid #0f172a;
    border-radius: 50%;
}

/* Text Container */
.user-info-col {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Hide overflow text */
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status-text {
    font-size: 0.7rem;
    color: #64748b;
}

/* --- CHAT BUBBLES (Fixed from previous step) --- */
.chat-bubble-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    width: 100%;
}
.chat-bubble-wrapper.sent { align-items: flex-end; }
.chat-bubble-wrapper.received { align-items: flex-start; }

.chat-message-container {
    display: flex;
    gap: 10px;
    max-width: 70%;
    align-items: flex-end;
}
.chat-bubble-wrapper.sent .chat-message-container {
    flex-direction: row; 
    justify-content: flex-end;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #334155;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: bold; font-size: 12px;
    flex-shrink: 0;
}

.chat-content-wrapper { display: flex; flex-direction: column; max-width: 100%; }
.chat-bubble-wrapper.sent .chat-content-wrapper { align-items: flex-end; }
.chat-bubble-wrapper.received .chat-content-wrapper { align-items: flex-start; }

.chat-bubble {
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: white;
    word-wrap: break-word;
    word-break: break-word;
    width: fit-content;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chat-bubble-wrapper.sent .chat-bubble {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-bottom-right-radius: 4px;
}
.chat-bubble-wrapper.received .chat-bubble {
    background-color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}

.chat-time { font-size: 11px; color: #64748b; margin-top: 4px; }
.chat-sender-name { font-size: 11px; color: #94a3b8; margin-bottom: 2px; margin-left: 2px; font-weight: bold; }


/* Unread Message Badge */
.unread-badge {
    background-color: #ef4444; /* Red-500 */
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: auto; /* Push to right */
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* --- GIF SUPPORT STYLES --- */

/* GIF Picker Box */
#gif-picker-container {
    backdrop-filter: blur(10px);
    background: rgba(15, 23, 42, 0.95);
}

/* Individual GIF in Picker */
.gif-item {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, border 0.2s;
    border: 2px solid transparent;
}
.gif-item:hover {
    transform: scale(1.05);
    border-color: #6366f1;
}

/* GIF Inside Chat Bubble */
.chat-gif-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin-top: 5px;
    display: block;
    min-width: 150px;
    min-height: 100px;
}
/* Remove padding/bg for GIF messages to make them look cleaner */
.chat-bubble-wrapper:not(.sent) .chat-bubble:has(.chat-gif-image),
.chat-bubble-wrapper.sent .chat-bubble:has(.chat-gif-image) {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
}


/* GIF Inside Chat Bubble - FIXED SIZE */
.chat-gif-image {
    max-width: 200px;  /* მაქსიმალური სიგანე 200px */
    max-height: 200px; /* მაქსიმალური სიმაღლე 200px */
    width: auto;
    height: auto;
    border-radius: 12px;
    margin-top: 5px;
    display: block;
    object-fit: cover; /* სურათი ლამაზად ჩაჯდება */
}

/* --- TRANSFER CARD STYLE --- */
.transfer-card {
    background: rgba(99, 102, 241, 0.1); /* Indigo tint */
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 12px;
    width: 240px;
    margin-top: 5px;
}
.transfer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    color: #818cf8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 6px;
}
.transfer-body {
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.6;
}
.transfer-body strong {
    color: white;
}
.transfer-btn {
    display: block;
    margin-top: 10px;
    background: #4f46e5;
    color: white;
    text-align: center;
    padding: 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: bold;
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
}
.transfer-btn:hover {
    background: #4338ca;
}