/* ============ BILGIN CHAT PRO - APPLE HIG EDITION ============ */
/* macOS & iOS Human Interface Guidelines (Strict) */
/* Monochrome: White & Black */

:root {
    /* 🍎 Apple System Colors (Monochrome) */
    --system-black: #000000;
    --system-white: #FFFFFF;
    --system-gray-1: #F5F5F7;
    /* Apple Background Gray */
    --system-gray-2: #E5E5EA;
    /* Apple Separators */
    --system-gray-3: #C7C7CC;
    /* Apple Disabled/Placeholder */
    --system-gray-4: #8E8E93;
    /* Apple Secondary Text */

    /* 🎨 Semantic Colors */
    --tint-color: #000000;
    /* Kullanıcı isteği: Siyah */
    --tint-secondary: #333333;

    /* 🟢 Status Colors */
    --status-success: #34C759;
    /* Apple Green */
    --status-danger: #FF3B30;
    /* Apple Red */

    /* 🌫️ Materials (Cam Efektleri) */
    --material-sidebar: rgba(245, 245, 247, 0.85);
    /* macOS Sidebar */
    --material-header: rgba(255, 255, 255, 0.85);
    /* macOS Header */
    --material-blur: blur(20px);

    /* 📏 Metrics */
    --radius-default: 12px;
    --radius-large: 16px;
    --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;

    /* 🌑 Shadows (Soft Apple Shadows) */
    --shadow-small: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-large: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* 🎬 Apple Animations */
    --spring-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --spring-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --spring-snappy: cubic-bezier(0.25, 0.1, 0.25, 1);
    --duration-fast: 0.15s;
    --duration-normal: 0.25s;
    --duration-slow: 0.4s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    /* Önemli: Apple font render */
}

body {
    font-family: var(--font-stack);
    background-color: var(--system-white);
    color: var(--system-black);
    line-height: 1.5;
    overflow: hidden;
}

/* ============ LAYOUT ============ */
.app-container {
    display: flex;
    height: 100vh;
    background: var(--system-white);
}

/* 🍎 Sidebar (Translucent) */
.sidebar {
    width: 300px;
    /* Standart macOS Sidebar genişliği */
    background: var(--material-sidebar);
    backdrop-filter: var(--material-blur);
    -webkit-backdrop-filter: var(--material-blur);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* border-bottom yok, Apple sidebar headerları genelde seamless olur ama ayırıcı koyalım */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: #E1E1E1;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-size: 15px;
    font-weight: 600;
    /* SF Pro Semibold */
    letter-spacing: -0.2px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--system-black);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    /* Butonlar arası boşluk */
}

/* Tabs (Segmented Control Style) */
.sidebar-tabs {
    padding: 12px 16px;
    display: flex;
}

.tab-btn {
    flex: 1;
    padding: 6px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--system-gray-4);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--system-black);
}

.tab-btn.active {
    background: rgba(0, 0, 0, 0.06);
    color: var(--system-black);
    font-weight: 600;
}

/* Search Bar (iOS Style) */
.search-container {
    padding: 0 16px 12px;
}

.search-box {
    background: rgba(118, 118, 128, 0.12);
    /* Apple standart gri input */
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box i {
    color: var(--system-gray-4);
    font-size: 14px;
}

.search-box input {
    border: none;
    background: transparent;
    font-size: 13px;
    width: 100%;
    outline: none;
    font-family: inherit;
}

/* Lists */
.chat-list,
.group-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 10px;
}

.chat-item {
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 2px;
    transition: all var(--duration-fast) var(--spring-smooth);
    transform: scale(1);
}

.chat-item:hover {
    background: rgba(0, 0, 0, 0.04);
    transform: scale(0.98);
}

.chat-item.active {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1);
}

.chat-item-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

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

.status-indicator {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--material-sidebar);
    /* Arka planla kaynaşsın */
    background: var(--system-gray-3);
}

.status-indicator.online {
    background: var(--status-success);
}

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

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.chat-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-item-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--system-black);
}

.chat-item-time {
    font-size: 12px;
    color: var(--system-gray-4);
}

.chat-item-last-msg {
    font-size: 13px;
    color: var(--system-gray-4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.unread-badge {
    background: var(--status-success);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* ============ MAIN CHAT ============ */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--system-white);
    position: relative;
}

.active-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--system-gray-3);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 🍎 Header (Translucent) */
.chat-header {
    height: 60px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--material-header);
    backdrop-filter: var(--material-blur);
    -webkit-backdrop-filter: var(--material-blur);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

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

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

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

.chat-username {
    font-size: 16px;
    font-weight: 600;
    color: var(--system-black);
}

/* Son Görülme Stili */
.chat-user-status {
    font-size: 12px;
    color: var(--system-gray-4);
    margin-top: 1px;
}

/* Messages Area */
.messages-container {
    flex: 1;
    /* Header (60px) + Boşluk (20px) = 80px Üst */
    padding: 80px 24px 80px;
    /* Input (70px) + Boşluk (10px) = 80px Alt */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--system-white);
    height: 100%;
    /* Garanti olsun */
}

/* 🍎 iMessage Style Bubbles */
.message {
    max-width: 65%;
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    animation: messageAppear var(--duration-normal) var(--spring-bounce);
    transform-origin: bottom;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* GÖNDEREN: Siyah (iMessage Blue yerine Siyah istendi) */
.message.sent {
    align-self: flex-end;
    background-color: var(--system-black);
    color: white;
    border-bottom-right-radius: 4px;
    /* iMessage kuyruğu efekti */
}

/* ALAN: Açık Gri (iMessage Gray) */
.message.received {
    align-self: flex-start;
    background-color: #E9E9EB;
    /* Tam iMessage gri tonu */
    color: black;
    border-bottom-left-radius: 4px;
}

.message img {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 6px;
    cursor: pointer;
}

.msg-status {
    font-size: 11px;
    margin-left: 6px;
    vertical-align: bottom;
}

.status-read {
    color: var(--status-success) !important;
}

/* Reply Preview Bar */
.reply-preview {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    transform: translateY(0);
    opacity: 1;
}

.reply-preview.hidden {
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.reply-content-wrapper {
    flex: 1;
    border-left: 3px solid var(--system-black);
    padding-left: 10px;
    display: flex;
    flex-direction: column;
}

.reply-sender-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--system-black);
}

.reply-message-text {
    font-size: 13px;
    color: var(--system-gray-4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.close-reply {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    font-size: 12px;
    color: var(--system-gray-4);
}

/* Reply Bubble inside Message */
.msg-reply-bubble {
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--system-gray-3);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 13px;
    display: block;
}

.msg-reply-sender {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 12px;
    opacity: 0.8;
}

/* Input Area - Absolute Bottom */
.chat-input-area {
    padding: 16px 24px;
    background: var(--material-header);
    /* Translucent */
    backdrop-filter: var(--material-blur);
    -webkit-backdrop-filter: var(--material-blur);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;

    /* Sabitleme */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 72px;
    /* Yükseklik sabilendi */
}

.chat-input-area input {
    flex: 1;
    height: 38px;
    padding: 0 16px;
    border-radius: 19px;
    /* Tam yuvarlak */
    border: 1px solid #C7C7CC;
    background: white;
    font-size: 15px;
    transition: border 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--system-black);
    outline: none;
}

.btn-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--system-black) !important;
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.1s;
    border: none;
    cursor: pointer;
}

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

#mic-btn.recording {
    background: var(--status-danger) !important;
    color: white;
    animation: pulse 1s infinite;
}

.recording-timer {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--status-danger);
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Code Blocks (High Contrast) */
pre {
    background: #1C1C1E !important;
    /* Apple Dark Mode Gray */
    border-radius: 12px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.copy-code-btn {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
}

/* Scrollbar (Invisible or Minimal) */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* Şık görünüm için gizlendi */

/* App Logo */
.app-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }

    .app-container.chat-open .sidebar {
        display: none;
    }

    .chat-header {
        position: -webkit-sticky;
        position: sticky;
    }

    /* Mobilde sticky */
}

/* Auth Page */
.auth-page {
    background: var(--system-gray-1);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-medium);
    width: 100%;
    max-width: 380px;
}

.auth-logo {
    width: 60px;
    height: 60px;
    background: black;
    border-radius: 14px;
    margin: 0 auto 24px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.btn-primary {
    background: black;
    color: white;
    height: 44px;
    border-radius: 10px;
    font-weight: 600;
    width: 100%;
    border: none;
    font-size: 15px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--spring-smooth);
}

.btn-primary:hover {
    transform: scale(0.98);
    background: #222;
}

.btn-primary:active {
    transform: scale(0.95);
}

/* Overlays */
/* Overlays */
.call-overlay,
.profile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

/* 💬 Typing Indicator (iMessage Style) */
.typing-indicator-container {
    padding: 0 16px 10px;
    display: none;
    align-self: flex-start;
}

.typing-indicator-container.visible {
    display: flex;
    animation: messageAppear var(--duration-normal) var(--spring-bounce);
}

.typing-bubble {
    background-color: #E9E9EB;
    /* Received message rengi */
    padding: 12px 18px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.typing-dot {
    width: 7px;
    height: 7px;
    background-color: #8E8E93;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.6;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Status Text Colors */
.status-typing {
    color: var(--status-success) !important;
    font-weight: 600;
}

.status-thinking {
    color: #FF9F0A !important;
    font-weight: 600;
}

/* Apple Orange */



.call-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.call-status {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

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

.call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
}

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

.call-btn:active {
    transform: scale(0.95);
}

.call-accept {
    background: #34C759;
}

.call-reject {
    background: #FF3B30;
}

.call-reject {
    background: #FF3B30;
}

.share-screen {
    background: var(--system-gray-4);
}

.share-screen.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(100%);
    background: #E5E5EA;
    /* Daha belirgin bir gri */
}

/* 💻 Code Blocks */
pre {
    background: #282c34 !important;
    /* Force dark background */
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
    overflow-x: auto;
    font-family: 'SF Mono', 'Menlo', monospace;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

code {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 13px;
    color: #abb2bf;
}

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    opacity: 0;
    /* Hover ile göster */
}

pre:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.call-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 32px;
    width: 320px;
    text-align: center;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    animation: popupSpring 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    background: var(--system-gray-1);
    border: none;
    border-radius: 8px;
    margin-top: 5px;
}

/* context-menu */
.context-menu {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.context-menu.hidden {
    display: none !important;
}

.context-btn {
    background: transparent;
    border: none;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--system-black);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    font-weight: 500;
}

.context-btn:hover {
    background: var(--system-gray-1);
    color: var(--system-black);
}

.context-btn i {
    font-size: 14px;
    width: 20px;
    color: var(--system-gray-4);
    text-align: center;
}