:root {
    --primary: #00d2ff;
    --primary-hover: #3a7bd5;
    --bg-main: #eeeeee;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f5f5;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-main: #1a1a2e;
    --text-muted: #64748b;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --msg-bg: #ffffff;
    --danger: #ef4444;
    --success: #22c55e
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none }

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    background: var(--bg-main);
}

::-webkit-scrollbar { width: 8px }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05) }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px }

.full-screen {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-main);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 20px;
    width: 380px;
    text-align: center;
    box-shadow: var(--shadow)
}

.logo {
    font-size: 2.5rem;
    background: linear-gradient(to right, #00d2ff, #3a7bd5);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    font-weight: 700
}

input, textarea, select {
    width: 100%;
    padding: 12px 15px;
    margin: 8px 0 20px;
    background: #f5f5f5;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    transition: 0.3s
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3)
}

select option { background: var(--bg-card); color: var(--text-main) }

.btn-main, .btn-main-chat {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.4);
    transition: transform 0.2s
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s
}

.btn-secondary:hover { background: var(--bg-card-hover) }

.toggle-link { margin-top: 15px; font-size: 0.9em; color: var(--text-muted); cursor: pointer }

#menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10000;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: left 0.3s ease-in-out;
    box-shadow: var(--shadow)
}

#menu-toggle:hover { box-shadow: 0 0 10px var(--primary) }

.sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 25px;
    padding-top: 80px;
    position: fixed;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 9000;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: var(--shadow)
}

.sidebar.active { transform: translateX(0); box-shadow: 10px 0 50px rgba(0, 0, 0, 0.15) }
.sidebar.active ~ #menu-toggle { left: 230px; z-index: 10001 }
.sidebar.active ~ .notification-container { display: none }

.sidebar-avatar-wrapper { position: relative; width: 90px; height: 90px; margin: 0 auto 15px }

.sidebar-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4)
}

.sidebar-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    color: white;
    border: 3px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4)
}

.sidebar-online-dot {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    background-color: #22c55e;
    border: 3px solid var(--bg-card);
    border-radius: 50%;
    animation: blink 2s infinite
}

#sidebar-profile-container h3 {
    color: var(--text-main);
    text-align: center;
}

.notification-container { position: fixed; top: 20px; right: 20px; z-index: 10000 }

#notif-btn, #messenger-btn {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    box-shadow: var(--shadow);
    transition: 0.3s;
    margin-left: 10px
}

#notif-btn:hover, #messenger-btn:hover { box-shadow: 0 0 10px var(--primary) }

#notif-badge, #msg-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid white
}

.notif-dropdown {
    position: fixed;
    top: 65px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    max-width: 90vw;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: none;
    overflow: hidden;
    z-index: 10001;
    max-height: 70vh;
    overflow-y: auto
}

.notif-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--glass-border)
}

.notif-item img { width: 35px; height: 35px; border-radius: 50%; object-fit: cover; margin-right: 10px }
.notif-info { flex: 1; font-size: 13px; color: var(--text-main) }
.notif-actions { display: flex; gap: 5px }
.btn-accept { background: var(--success); border: none; color: white; border-radius: 5px; cursor: pointer; padding: 5px }
.btn-reject { background: var(--danger); border: none; color: white; border-radius: 5px; cursor: pointer; padding: 5px }

#messenger-dropdown .msg-info { margin-left: 10px; flex: 1 }
#messenger-dropdown .msg-name { font-weight: 600; color: var(--text-main); font-size: 14px }
#messenger-dropdown .msg-preview { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px }

#app { display: flex; height: 100vh; position: relative }

.content {
    flex: 1;
    padding: 20px;
    padding-top: 80px;
    overflow-y: auto;
    width: 100%;
    height: 100vh;
    background: var(--bg-main)
}

/* ჩატის tab - სპეციალური სტილები */
#tab-chat {
    padding: 0 !important;
    padding-top: 60px !important;
    overflow: hidden !important;
}

.nav-menu { list-style: none; margin-top: 20px }

.nav-menu li {
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-muted);
    margin-bottom: 8px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500
}

.nav-menu li:hover, .nav-menu li.active {
    background: rgba(0, 210, 255, 0.15);
    color: var(--primary);
    transform: translateX(5px)
}

/* ========== FULLSCREEN ჩატი - Telegram სტილი ========== */
.global-chat-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    overflow: hidden;
}

/* Header მოშორებულია */
.chat-header {
    display: none !important;
}

.chat-display {
    flex: 1;
    padding: 15px;
    padding-bottom: 80px; /* ადგილი fixed input-ისთვის */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-main);
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar დამალვა მობილურზე */
.chat-display::-webkit-scrollbar {
    width: 4px;
}
.chat-display::-webkit-scrollbar-thumb {
    background: rgba(0, 210, 255, 0.3);
    border-radius: 4px;
}

.chat-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    font-size: 0.9em;
    line-height: 1.4;
    border-bottom-left-radius: 4px;
    word-wrap: break-word;
    border: 1px solid var(--glass-border)
}

.chat-bubble.me {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 4px
}

.chat-bubble.me .author { color: rgba(255, 255, 255, 0.9) }
.chat-bubble.me .msg-text { color: white }

.msg-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px }
.chat-bubble .author { font-size: 0.75em; color: var(--primary); font-weight: 600 }
.msg-text { margin: 0; color: var(--text-main) }

.msg-menu-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 14px; visibility: hidden }
.chat-bubble:hover .msg-menu-btn { visibility: visible }

.msg-dropdown {
    position: absolute;
    right: 0;
    top: 30px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    z-index: 100;
    overflow: hidden;
    min-width: 130px;
    display: none;
    box-shadow: var(--shadow)
}

.msg-dropdown button {
    display: block;
    width: 100%;
    border: none;
    background: none;
    padding: 10px;
    text-align: left;
    cursor: pointer;
    color: var(--text-main);
    font-size: 13px
}

.msg-dropdown button:hover { background: var(--bg-card-hover) }
.msg-dropdown button.danger { color: var(--danger) }

.reaction-bar { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap }
.reaction-pill {
    background: var(--bg-card-hover);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px
}

/* ჩატის input - FIXED ქვემოთ */
.chat-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 10px 15px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--glass-border);
    z-index: 100;
}

#chat-input {
    flex: 1;
    background: #f5f5f5 !important;
    color: var(--text-main) !important;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 10px 15px;
    margin: 0;
    font-size: 15px;
}

.btn-main-chat {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    padding: 0
}

.icon-btn { 
    background: none; 
    border: none; 
    font-size: 1.2em; 
    color: var(--text-muted); 
    cursor: pointer;
    padding: 8px;
}
.icon-btn:hover { color: var(--primary) }

/* ========== დანარჩენი სტილები ========== */

.online-card {
    position: relative;
    background: transparent;
    padding: 12px 8px;
    border-radius: 12px;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: none
}

.online-card:hover {
    background: rgba(0, 210, 255, 0.08);
}

.online-card h4 {
    color: var(--text-main);
    margin: 5px 0;
    font-size: 14px;
    font-weight: 500
}

.avatar-wrapper { position: relative; display: inline-block; width: 55px; height: 55px; margin-bottom: 8px }

.online-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0, 210, 255, 0.3);
}

.online-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #22c55e;
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    animation: blink 2s infinite
}

@keyframes blink {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7) }
    70% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0) }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0) }
}

.profile-header {
    height: 250px;
    position: relative;
    background-color: #e0e0e0;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px
}

.cover-photo {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    position: relative
}

.profile-avatar-container {
    width: 150px;
    height: 150px;
    position: absolute;
    bottom: -75px;
    left: 40px;
    border-radius: 50%;
    border: 5px solid var(--bg-card);
    background: var(--bg-card);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    z-index: 10
}

.profile-avatar-big { width: 100%; height: 100%; object-fit: cover; display: block }

.edit-btn {
    position: absolute;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: 0.3s
}

.edit-btn:hover { background: var(--primary) }
.cover-btn { bottom: 15px; right: 15px }

.avatar-btn {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0;
    opacity: 0;
    transition: 0.3s
}

.profile-avatar-container:hover .avatar-btn { opacity: 1 }

.profile-body {
    padding-top: 90px;
    padding-left: 30px;
    padding-right: 30px;
    padding-bottom: 30px
}

.profile-container, .dash-box, .admin-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow)
}

#v-fullname { color: var(--text-main) }
#v-username { color: var(--text-muted) }
#v-gender { color: var(--text-muted) }
#v-bio { color: var(--text-main); background: var(--bg-card-hover); border-radius: 10px; padding: 15px }

.profile-grid .info-item label { color: var(--text-muted) }
.profile-grid .info-item p { color: var(--text-main) }
.profile-info-block h3 { color: var(--text-muted) }
.friends-section h3 { color: var(--text-main) }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px }
.full-user-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px }

.edit-input {
    background: var(--bg-card-hover);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 100%;
    padding: 5px;
    border-radius: 5px
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    color: white
}

/* ========== მობილური ========== */
@media (max-width: 768px) {
    .content { 
        padding: 10px; 
        padding-top: 60px;
    }
    
    /* ჩატი მობილურზე */
    #tab-chat {
        padding: 0 !important;
        padding-top: 55px !important;
        overflow: hidden !important;
    }
    
    .global-chat-container { 
        top: 55px;
    }
    
    .chat-display {
        padding: 10px;
        padding-bottom: 75px;
    }
    
    /* Scrollbar სრულად დამალვა მობილურზე */
    .chat-display::-webkit-scrollbar {
        display: none;
    }
    .chat-display {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    .chat-bubble { 
        max-width: 85%;
        padding: 8px 12px;
        font-size: 0.88em;
    }
    
    .chat-controls {
        padding: 8px 10px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        gap: 6px;
    }
    
    #chat-input {
        padding: 8px 12px;
        font-size: 16px; /* iOS zoom-ის თავიდან აცილება */
    }
    
    .btn-main-chat {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
    
    .icon-btn {
        padding: 6px;
        font-size: 1.1em;
    }
    
    .profile-avatar-container { 
        width: 80px; 
        height: 80px; 
        bottom: -40px; 
        left: 15px;
    }
    
    .profile-body {
        padding-top: 55px !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        padding-bottom: 20px !important;
    }
    
    .profile-header {
        height: 150px;
    }
}

/* ონლაინ კარტის დამატებითი სტილები */
.user-info-line { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 5px; font-size: 13px }
.gender-icon { font-size: 16px }
.age-badge {
    background: var(--bg-card-hover);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-muted)
}
/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 15px;
    color: var(--text-muted);
    font-size: 12px;
    background: var(--bg-main);
    margin-top: auto;
}

/* ===== ჩატის ავატარი ===== */
.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

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

.msg-avatar-letter {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

/* ფოტო/მიკროფონი ფერები */
.photo-btn { color: #3b82f6 !important; }
.mic-btn { color: #ef4444 !important; }

/* მენშენი */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 10px;
    right: 10px;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-bottom: 5px;
}

.mention-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mention-item:hover { background: rgba(0, 210, 255, 0.1); }

.mention-highlight {
    color: var(--primary);
    font-weight: bold;
}

/* Voice Recording */
.voice-recording-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--danger);
    z-index: 101;
}

.voice-recording-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--danger);
    font-size: 18px;
    font-weight: 600;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse-rec 1s infinite;
}

@keyframes pulse-rec {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.voice-recording-actions { display: flex; gap: 15px; }

.voice-action-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.voice-action-btn.delete-btn { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.voice-action-btn.stop-btn { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.voice-action-btn.send-btn { background: rgba(34, 197, 94, 0.15); color: var(--success); }

/* Audio message */
.audio-message { width: 100%; max-width: 250px; }
.audio-message audio { width: 100%; height: 36px; }

/* ===== Language Button ===== */
.lang-btn {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    margin-left: 10px;
}

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

.header-lang-btn {
    margin-left: 10px;
}

.auth-lang-btn {
    position: absolute;
    top: 15px;
    right: 15px;
}

.auth-card {
    position: relative;
}

/* Notification button colors */
#messenger-btn {
    color: #00d2ff !important;
    border-color: #00d2ff !important;
}

#notif-btn {
    color: #fbbf24 !important;
    border-color: #fbbf24 !important;
}