* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #fff;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.icon-btn {
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #707579;
}

.icon-btn:hover {
    background-color: #f4f4f5;
}

/* Menu Sidebar */
.menu-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: none;
}

.menu-sidebar.open {
    display: block;
}

.menu-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.menu-content {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 320px;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.menu-sidebar.open .menu-content {
    transform: translateX(0);
}

.menu-header {
    background: #3390ec;
    color: white;
    padding: 24px;
    position: relative;
}

.close-menu-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    color: white;
}

.close-menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.profile-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-username {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.menu-items {
    padding: 8px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #222;
}

.menu-item:hover {
    background-color: #f4f4f5;
}

.menu-item svg {
    flex-shrink: 0;
    color: #707579;
}

.menu-item span:first-of-type {
    flex: 1;
}

.menu-badge {
    background: #3390ec;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.menu-divider {
    height: 8px;
    background: #f4f4f5;
}

.menu-footer {
    border-top: 1px solid #e5e5ea;
    padding: 16px;
    text-align: center;
    margin-top: auto;
}

.menu-footer p {
    font-size: 12px;
    color: #8e8e93;
}

/* Sidebar */
.sidebar {
    width: 100%;
    max-width: 420px;
    background: white;
    border-right: 1px solid #e5e5ea;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-bottom: 1px solid #e5e5ea;
    background: #3390ec;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.search-container {
    position: relative;
    padding: 12px;
    border-bottom: 1px solid #e5e5ea;
}

.search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: #8e8e93;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: #f4f4f5;
    border: none;
    border-radius: 22px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    background: white;
    box-shadow: 0 0 0 2px #3390ec;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #e5e5ea;
    overflow-x: auto;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    padding: 6px 16px;
    background: #f4f4f5;
    border: none;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    color: #707579;
}

.filter-tab:hover {
    background: #e5e5ea;
}

.filter-tab.active {
    background: #3390ec;
    color: white;
}

/* Chat List */
.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-list::-webkit-scrollbar {
    width: 6px;
}

.chat-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-list::-webkit-scrollbar-thumb {
    background: #d1d1d6;
    border-radius: 3px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f4f4f5;
}

.chat-item:hover {
    background-color: #f9f9f9;
}

.chat-item.selected {
    background-color: #e8f4fb;
}

.chat-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.chat-item-avatar.placeholder {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
}

.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-item-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.chat-item-name {
    font-weight: 600;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item-time {
    font-size: 12px;
    color: #8e8e93;
    flex-shrink: 0;
    margin-left: 8px;
}

.chat-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-item-message {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.chat-item-text {
    font-size: 14px;
    color: #707579;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-badge {
    min-width: 20px;
    height: 20px;
    background: #3390ec;
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
    margin-left: 8px;
}

.unread-badge.muted {
    background: #8e8e93;
}

.check-icon {
    width: 16px;
    height: 16px;
    color: #8e8e93;
    flex-shrink: 0;
}

.check-icon.read {
    color: #3390ec;
}

.pin-icon,
.mute-icon {
    width: 16px;
    height: 16px;
    color: #8e8e93;
    flex-shrink: 0;
}

/* Chat Window */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f4f4f5;
}

.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}

.empty-state-content {
    text-align: center;
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    background: #dbeafe;
    border-radius: 50%;
    margin-bottom: 24px;
    color: #3390ec;
}

.empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.empty-state p {
    color: #6b7280;
    max-width: 400px;
    margin: 0 auto;
}

.chat-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #e5e5ea;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-avatar.placeholder {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.chat-name {
    font-size: 16px;
    font-weight: 600;
    color: #222;
}

.chat-status {
    font-size: 12px;
    color: #8e8e93;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

/* Messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 50%, #e0f2fe 100%);
    position: relative;
}

.messages-wrapper {
    position: relative;
    z-index: 1;
}

.message-bubble {
    display: flex;
    margin-bottom: 8px;
}

.message-bubble.own {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 12px;
}

.message-content.own {
    background: #3390ec;
    color: white;
    border-bottom-right-radius: 2px;
}

.message-content.other {
    background: white;
    color: #222;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    color: #3390ec;
    margin-bottom: 4px;
}

.message-text {
    font-size: 14px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}

.message-time {
    font-size: 11px;
}

.message-content.own .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-content.other .message-time {
    color: #8e8e93;
}

.message-check {
    width: 16px;
    height: 16px;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e5ea;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.message-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid #d1d1d6;
    border-radius: 21px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 128px;
    transition: all 0.2s;
}

.message-input:focus {
    border-color: #3390ec;
    box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.1);
}

.emoji-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.send-btn {
    width: 42px;
    height: 42px;
    background: #3390ec;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
    color: white;
}

.send-btn:hover {
    background: #2b7fd1;
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #8e8e93;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e5ea;
    border-top-color: #3390ec;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        max-width: 100%;
    }

    .chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
    }

    .chat-window.hidden {
        display: none;
    }
}

@media (min-width: 769px) {
    .menu-overlay {
        display: none;
    }
}

/* Dosya Mesajları */
.message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.message-file:hover {
    background: rgba(0, 0, 0, 0.1);
}

.message-content.own .message-file {
    background: rgba(255, 255, 255, 0.2);
}

.message-content.own .message-file:hover {
    background: rgba(255, 255, 255, 0.3);
}

.message-file svg {
    flex-shrink: 0;
    color: #3390ec;
}

.message-content.own .message-file svg {
    color: white;
}

.message-file span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-file small {
    color: #8e8e93;
    font-size: 11px;
}

.message-content.own .message-file small {
    color: rgba(255, 255, 255, 0.7);
}

.message-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.message-image:hover {
    opacity: 0.9;
}

/* Error & Retry States */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #8e8e93;
    text-align: center;
}

.error-state p {
    margin-bottom: 16px;
}

.retry-btn {
    padding: 8px 20px;
    background: #3390ec;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.retry-btn:hover {
    background: #2b7fd1;
}

/* Arama Vurgulama */
.chat-item-name mark {
    background: #fef08a;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}
