@import url("mobile.css");
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --online: #22c55e;
    --message-out: #3b82f6;
    --message-in: #334155;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Screens */
.screen {
    display: none;
    height: 100vh;
}
.screen.active {
    display: flex;
}

/* Auth Screen */
#auth-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 64px;
    margin-bottom: 10px;
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 25px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--accent);
    color: white;
}

.auth-form {
    display: none;
}
.auth-form.active {
    display: block;
}

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

.form-group input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-primary);
    border: 2px solid var(--bg-tertiary);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59,130,246,0.3);
}

.error-message {
    margin-top: 15px;
    padding: 12px;
    background: rgba(239,68,68,0.1);
    border: 1px solid var(--danger);
    border-radius: 8px;
    color: var(--danger);
    font-size: 14px;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
}

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

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--accent);
}

.search-box {
    padding: 12px 16px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

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

.chat-item.active {
    background: rgba(59,130,246,0.1);
    border-left-color: var(--accent);
}

.chat-item .avatar {
    width: 48px;
    height: 48px;
    font-size: 18px;
    position: relative;
}

.chat-item .avatar.online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--online);
    border: 2px solid var(--bg-secondary);
    border-radius: 50%;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-info p {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    text-align: right;
}

.chat-meta .time {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-meta .unread {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
    display: inline-block;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.empty-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-chat h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.empty-chat p {
    color: var(--text-secondary);
    font-size: 14px;
    max-width: 300px;
}

/* Active Chat */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
}

.chat-header .avatar {
    width: 44px;
    height: 44px;
}

.chat-header-info h3 {
    font-size: 16px;
    font-weight: 600;
}

.chat-header-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
}

.message.outgoing {
    align-self: flex-end;
    background: var(--message-out);
    border-bottom-right-radius: 4px;
}

.message.incoming {
    align-self: flex-start;
    background: var(--message-in);
    border-bottom-left-radius: 4px;
}

.message .sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.message .time {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
    text-align: right;
}

.message.incoming .time {
    color: var(--text-secondary);
}

/* Message Input */
.message-input-container {
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
    border-radius: 25px;
    padding: 8px 8px 8px 20px;
}

.message-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.message-input-wrapper input::placeholder {
    color: var(--text-secondary);
}

.btn-send {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-send:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.modal-header h3 {
    font-size: 18px;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-body input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-primary);
    border: 2px solid var(--bg-tertiary);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    margin-bottom: 16px;
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--message-in);
    border-radius: 18px;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 10;
    }
    .chat-main {
        width: 100%;
    }
    .sidebar.hidden {
        display: none;
    }
}

/* Yeni özellikler için stiller */
.header-actions {
    display: flex;
    gap: 8px;
}

.group-avatar {
    background: linear-gradient(135deg, #8b5cf6, #6366f1) !important;
    font-size: 18px !important;
}

/* Dosya ekleme butonu */
.btn-attach {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s;
}

.btn-attach:hover {
    color: var(--accent);
}

/* Mesaj içi medya */
.message-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-video {
    max-width: 300px;
    border-radius: 12px;
}

.message-audio {
    width: 250px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s;
}

.message-file:hover {
    background: rgba(255,255,255,0.15);
}

/* Seçilen üyeler */
.selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.member-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--accent);
    border-radius: 20px;
    font-size: 13px;
}

.member-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
}

/* Loading */
.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

/* Emoji Picker */
.emoji-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    font-size: 20px;
    transition: all 0.3s;
}

.emoji-btn:hover {
    transform: scale(1.2);
}

.emoji-picker {
    display: none;
    position: absolute;
    bottom: 70px;
    left: 20px;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    padding: 12px;
    width: 320px;
    max-height: 350px;
    overflow: hidden;
    z-index: 100;
}

.emoji-picker.active {
    display: block;
}

.emoji-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--bg-tertiary);
    padding-bottom: 8px;
}

.emoji-tab {
    background: transparent;
    border: none;
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.emoji-tab:hover, .emoji-tab.active {
    background: var(--bg-tertiary);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 250px;
    overflow-y: auto;
}

.emoji-item {
    font-size: 24px;
    padding: 6px;
    cursor: pointer;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
}

.emoji-item:hover {
    background: var(--bg-tertiary);
    transform: scale(1.2);
}

.emoji-search {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 12px;
}

/* Bildirim animasyonu */
@keyframes notificationPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.chat-item.new-message {
    animation: notificationPulse 0.3s ease;
    background: rgba(99, 102, 241, 0.2);
}

/* Tarayıcı izni butonu */
.notification-permission {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    margin: 10px;
}

/* Logout butonu */
#logout-btn {
    color: #ef4444;
}

#logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ========== CALL UI ========== */
.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-container {
    text-align: center;
    color: white;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.call-container.video-call {
    background: #000;
}

#remote-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#local-video {
    position: absolute;
    bottom: 120px;
    right: 20px;
    width: 150px;
    height: 200px;
    border-radius: 12px;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.3);
    z-index: 10;
}

.call-info {
    position: relative;
    z-index: 5;
}

.call-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    margin: 0 auto 20px;
}

.call-avatar.pulse {
    animation: avatarPulse 1.5s infinite;
}

@keyframes avatarPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(99, 102, 241, 0); }
}

.call-info h3 {
    font-size: 28px;
    margin: 0 0 10px;
}

.call-info p {
    font-size: 16px;
    opacity: 0.7;
    margin: 0;
}

#call-timer {
    font-size: 24px;
    font-weight: 600;
    margin-top: 10px;
    font-family: monospace;
}

.call-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 10;
}

.call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.call-btn:hover {
    transform: scale(1.1);
}

.call-btn.active {
    background: #ef4444;
}

.call-btn.end-btn {
    background: #ef4444;
    width: 70px;
    height: 70px;
}

.call-btn.end-btn:hover {
    background: #dc2626;
}

.call-btn.accept-btn {
    background: #22c55e;
}

.call-btn.accept-btn:hover {
    background: #16a34a;
}

.call-btn.reject-btn {
    background: #ef4444;
}

/* Gelen arama */
.incoming-call-box {
    background: linear-gradient(135deg, #1e1e2e, #2d2d44);
    padding: 40px 60px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.incoming-call-box h3 {
    color: white;
    font-size: 24px;
    margin: 20px 0 10px;
}

.incoming-call-box p {
    color: rgba(255,255,255,0.7);
    margin: 0 0 30px;
}

.incoming-call-actions {
    display: flex;
    gap: 40px;
    justify-content: center;
}

/* Chat header'da arama butonları */
.call-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.call-header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.call-header-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

/* Admin butonu */
#admin-btn {
    color: #f59e0b;
    text-decoration: none;
}

#admin-btn:hover {
    background: rgba(245, 158, 11, 0.2);
}

/* Logout butonu - kırmızı ve belirgin */
#logout-btn {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
}

#logout-btn:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    transform: scale(1.05);
}

/* Header butonları düzeni */
.header-actions {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
}

.header-actions .btn-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.3s;
}

/* Profil avatar linki */
.sidebar-header .avatar {
    cursor: pointer;
    transition: all 0.3s;
}

.sidebar-header .avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

/* Avatar resmi varsa */
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ===================== CHAT HEADER STYLES ===================== */

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
}

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

.chat-header-info .avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    overflow: hidden;
}

.chat-header-text {
    display: flex;
    flex-direction: column;
}

.chat-header-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.chat-header-status {
    font-size: 13px;
    color: var(--text-secondary);
}

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

.call-buttons {
    display: flex;
    gap: 8px;
}

#group-settings-btn {
    background: var(--bg-tertiary);
    border-radius: 10px;
    transition: all 0.3s;
}

#group-settings-btn:hover {
    background: var(--accent);
    transform: scale(1.05);
}

/* ===================== ACTIVE CHAT STYLES ===================== */

.active-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
}

.message-input-area input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.message-input-area input[type="text"]:focus {
    box-shadow: 0 0 0 2px var(--accent);
}

.btn-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-send:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.4);
}

.btn-send svg {
    color: white;
}

.attach-btn, .emoji-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
}

.attach-btn:hover, .emoji-btn:hover {
    color: var(--accent);
}

/* ===================== EMOJI PICKER ===================== */

.emoji-picker {
    position: absolute;
    bottom: 70px;
    left: 60px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    max-width: 320px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.emoji-category {
    color: var(--text-secondary);
    font-size: 12px;
    margin: 10px 0 5px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
}

.emoji {
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    text-align: center;
    transition: background 0.2s;
}

.emoji:hover {
    background: var(--bg-tertiary);
}

/* ===================== SELECTED MEMBERS ===================== */

.selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.selected-member {
    background: var(--accent);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-member button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.selected-member button:hover {
    background: rgba(255,255,255,0.4);
}

/* ===================== SEARCH RESULTS ===================== */

.search-results {
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-item .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    overflow: hidden;
}

.search-result-item .info .name {
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-item .info .username {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===================== EMOJI PICKER IMPROVED ===================== */

.emoji-picker {
    position: absolute;
    bottom: 70px;
    left: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    width: 340px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 1000;
}

.emoji-picker::-webkit-scrollbar {
    width: 6px;
}

.emoji-picker::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.emoji-picker::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.emoji-category {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    margin: 12px 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.emoji-category:first-child {
    margin-top: 0;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji {
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
    user-select: none;
}

.emoji:hover {
    background: var(--bg-tertiary);
    transform: scale(1.2);
}

.emoji:active {
    transform: scale(0.95);
}

/* Message input area positioning fix */
.message-input-area {
    position: relative;
}

/* ===================== GROUP AVATAR SECTION ===================== */

.group-avatar-section {
    text-align: center;
    margin-bottom: 20px;
}

.group-avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 3px dashed var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.group-avatar-preview:hover {
    border-color: #8b5cf6;
    transform: scale(1.05);
}

.group-avatar-preview:hover .group-avatar-overlay {
    opacity: 1;
}

#group-avatar-placeholder {
    font-size: 36px;
}

#group-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(99, 102, 241, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 17px;
}

.group-avatar-overlay span {
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.avatar-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.group-avatar-preview.has-image {
    border-style: solid;
    border-color: var(--success);
}

.group-avatar-preview.has-image #group-avatar-placeholder {
    display: none;
}

/* ===================== PWA INSTALL BANNER ===================== */

#install-banner {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-top: 1px solid var(--accent);
    padding: 15px 20px;
    z-index: 10000;
    transition: bottom 0.3s ease;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.3);
}

#install-banner.show {
    bottom: 0;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.install-icon {
    font-size: 32px;
}

.install-text {
    flex: 1;
}

.install-text strong {
    display: block;
    font-size: 16px;
    color: var(--text-primary);
}

.install-text small {
    font-size: 13px;
    color: var(--text-secondary);
}

.install-btn {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.install-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.4);
}

.install-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
}

.install-close:hover {
    color: var(--text-primary);
}

/* ===================== MOBILE RESPONSIVE ===================== */

@media (max-width: 768px) {
    /* Chat Layout */
    .chat-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--bg-tertiary);
    }
    
    .chat-main {
        flex: 1;
        height: 60vh;
    }
    
    /* Sidebar Header */
    .sidebar-header {
        padding: 10px 15px;
    }
    
    .user-info {
        gap: 10px;
    }
    
    .user-info .avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    #user-name {
        font-size: 14px;
    }
    
    .header-actions {
        gap: 5px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
    }
    
    /* Search Box */
    .search-box {
        padding: 10px 15px;
    }
    
    .search-box input {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* Chat List */
    .chat-list {
        max-height: calc(40vh - 120px);
    }
    
    .chat-item {
        padding: 12px 15px;
    }
    
    .chat-avatar {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .chat-name {
        font-size: 14px;
    }
    
    .chat-last-message {
        font-size: 12px;
    }
    
    /* Chat Header */
    .chat-header {
        padding: 12px 15px;
    }
    
    .chat-header-info .avatar {
        width: 40px;
        height: 40px;
    }
    
    .chat-header-name {
        font-size: 15px;
    }
    
    .chat-header-status {
        font-size: 12px;
    }
    
    /* Messages */
    .messages-container {
        padding: 15px;
    }
    
    .message {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .message-time {
        font-size: 10px;
    }
    
    /* Message Input */
    .message-input-area {
        padding: 10px 15px;
        gap: 8px;
    }
    
    .message-input-area input[type="text"] {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .btn-send {
        width: 40px;
        height: 40px;
    }
    
    .attach-btn, .emoji-btn {
        padding: 8px;
    }
    
    /* Emoji Picker Mobile */
    .emoji-picker {
        left: 5px;
        right: 5px;
        width: auto;
        max-width: none;
        bottom: 65px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .emoji {
        font-size: 24px;
        padding: 8px;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    /* Auth Screen */
    .auth-container {
        padding: 20px;
        margin: 10px;
    }
    
    .auth-logo h1 {
        font-size: 28px;
    }
    
    .logo-icon {
        font-size: 48px;
    }
    
    /* Empty Chat */
    .empty-chat {
        padding: 30px 20px;
    }
    
    .empty-icon {
        font-size: 48px;
    }
    
    .empty-chat h2 {
        font-size: 20px;
    }
    
    .empty-chat p {
        font-size: 14px;
    }
    
    /* Install Banner Mobile */
    .install-content {
        flex-wrap: wrap;
    }
    
    .install-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    /* Call Modal Mobile */
    .call-modal .call-container {
        padding: 20px;
    }
    
    .call-info .call-avatar {
        width: 80px;
        height: 80px;
    }
    
    .call-controls {
        gap: 15px;
    }
    
    .call-btn {
        width: 55px;
        height: 55px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        max-height: 35vh;
    }
    
    .chat-main {
        height: 65vh;
    }
    
    .chat-list {
        max-height: calc(35vh - 110px);
    }
    
    .message {
        max-width: 90%;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .install-text small {
        display: none;
    }
}

/* Safe Area for notched phones */
@supports (padding: max(0px)) {
    .sidebar-header {
        padding-top: max(10px, env(safe-area-inset-top));
    }
    
    .message-input-area {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
    
    #install-banner {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}

/* Standalone mode (PWA olarak açıldığında) */
@media (display-mode: standalone) {
    .sidebar-header {
        padding-top: 15px;
    }
    
    #install-banner {
        display: none !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .chat-item:active {
        background: var(--bg-tertiary);
    }
    
    .btn-icon:active {
        transform: scale(0.95);
    }
    
    .message:active {
        opacity: 0.9;
    }
    
    .emoji:active {
        transform: scale(1.3);
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-layout {
        flex-direction: row;
    }
    
    .sidebar {
        width: 300px;
        max-height: 100vh;
        border-bottom: none;
        border-right: 1px solid var(--bg-tertiary);
    }
    
    .chat-main {
        height: 100vh;
    }
    
    .chat-list {
        max-height: calc(100vh - 120px);
    }
}
