/* ============================================================
   CHATCHIP - MODERN CSS (Düzeltilmiş)
   ============================================================ */

/* ----- TEMA DEĞİŞKENLERİ ----- */
:root {
    --bg-primary: #F2FCF9;
    --bg-secondary: #FFFFFF;
    --bg-chat: #F2FCF9;
    --text-primary: #2D4A44;
    --text-secondary: #6B8A82;
    --border-color: #D4F0EA;
    --shadow-color: rgba(123, 211, 201, 0.18);
    --shadow-sm: 0 2px 12px rgba(123, 211, 201, 0.10);
    --card-bg: rgba(255, 255, 255, 0.85);
    --bubble-user: #7BD3C9;
    --bubble-user-text: #FFFFFF;
    --bubble-bot: rgba(255, 255, 255, 0.85);
    --bubble-bot-border: #D4F0EA;
    --input-bg: #F2FCF9;
    --input-border: #D4F0EA;
    --primary: #7BD3C9;
    --primary-dark: #5FB8A0;
    --hover-bg: rgba(123, 211, 201, 0.08);
    --sidebar-bg: rgba(255, 255, 255, 0.95);
    --toast-bg: #2D4A44;
}

[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-chat: #0F172A;
    --text-primary: #E2E8F0;
    --text-secondary: #94A3B8;
    --border-color: #334155;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.3);
    --card-bg: rgba(30, 41, 59, 0.85);
    --bubble-user: #2DD4BF;
    --bubble-user-text: #0F172A;
    --bubble-bot: rgba(30, 41, 59, 0.85);
    --bubble-bot-border: #334155;
    --input-bg: #1E293B;
    --input-border: #334155;
    --primary: #2DD4BF;
    --primary-dark: #14B8A6;
    --hover-bg: rgba(45, 212, 191, 0.08);
    --sidebar-bg: rgba(15, 23, 42, 0.95);
    --toast-bg: #1E293B;
}

/* ----- RESET & FONT ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    transition: background 0.3s, color 0.3s;
}

/* ----- APP CONTAINER ----- */
.app-container {
    width: 100%;
    max-width: 480px;
    height: 100dvh;
    max-height: 900px;
    background: var(--bg-secondary);
    display: flex;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 8px 40px var(--shadow-color);
    position: relative;
    transition: background 0.3s;
}

@media (max-width: 480px) {
    .app-container {
        max-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

/* ----- HEADER ----- */
.header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
    transition: background 0.3s;
    min-height: 56px;
}

.menu-btn,
.profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover,
.profile-btn:hover {
    background: var(--hover-bg);
}

.header-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.page-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* ----- PLAN BADGE ----- */
.plan-badge {
    font-size: 0.5rem;
    padding: 2px 10px;
    border-radius: 12px;
    background: #D1FAE5;
    color: #065F46;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s;
}

[data-theme="dark"] .plan-badge {
    background: #1E293B;
    color: #2DD4BF;
}

/* ----- PLAN WARNING ----- */
#planWarning {
    background: #FEF3C7;
    border-left: 4px solid #F59E0B;
    padding: 6px 12px;
    margin: 0 12px;
    font-size: 0.7rem;
    color: #92400E;
    border-radius: 6px;
    display: none;
}

[data-theme="dark"] #planWarning {
    background: #1E293B;
    color: #FCD34D;
    border-left-color: #F59E0B;
}

#planWarning a {
    color: #d97706;
    text-decoration: underline;
}

/* ----- CHAT AREA ----- */
.chat-area {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    background: var(--bg-chat);
    transition: background 0.3s;
}

.welcome {
    text-align: center;
    padding: 30px 0;
}

.welcome h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.welcome p {
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 0.9rem;
}

/* ----- MESSAGES ----- */
.message {
    margin-bottom: 12px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message .bubble {
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user .bubble {
    background: var(--bubble-user);
    color: var(--bubble-user-text);
    border-bottom-right-radius: 4px;
}

.message.bot .bubble {
    background: var(--bubble-bot);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    border: 1px solid var(--bubble-bot-border);
    border-bottom-left-radius: 4px;
}

.message .time {
    font-size: 0.55rem;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
    opacity: 0.7;
}

.message.user .time {
    color: rgba(255,255,255,0.7);
}

/* ----- INPUT AREA ----- */
.input-area {
    padding: 8px 16px 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: background 0.3s;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    background: var(--input-bg);
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    border: 1.5px solid var(--input-border);
    transition: all 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 211, 201, 0.1);
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    max-height: 120px;
    font-family: inherit;
    color: var(--text-primary);
    min-height: 24px;
}

.input-wrapper textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}


.input-wrapper button:hover {
    background: var(--primary-dark);
    transform: scale(1.04);
}

.input-wrapper button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ===== SIDEBARS ===== */
.sidebar-left,
.sidebar-right {
    position: absolute;
    top: 0;
    width: 280px;
    height: 100%;
    background: var(--sidebar-bg);
    backdrop-filter: blur(16px);
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sidebar-left {
    left: 0;
    transform: translateX(-100%);
}

.sidebar-left.active {
    transform: translateX(0);
}

.sidebar-right {
    right: 0;
    transform: translateX(100%);
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.sidebar-right.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.sidebar-header .logo img {
    width: 28px;
    height: 28px;
}

.close-sidebar {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
}

/* ----- NEW CHAT BUTTON ----- */
.new-chat-btn {
    margin: 10px 12px;
    padding: 10px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.85rem;
}

.new-chat-btn:hover {
    background: var(--primary-dark);
}

/* ----- CHAT HISTORY ----- */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: 2px;
    gap: 4px;
}

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

.history-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.history-item:hover .history-actions {
    opacity: 1;
}

.history-btn {
    background: transparent;
    border: none;
    font-size: 0.7rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 2px 4px;
    border-radius: 4px;
}

.history-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

/* ----- SEARCH CHAT ----- */
.search-chat {
    padding: 6px 12px;
    flex-shrink: 0;
}

.search-chat input {
    width: 100%;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    font-size: 0.7rem;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    transition: border 0.2s;
}

.search-chat input:focus {
    border-color: var(--primary);
}

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

/* ----- SIDEBAR FOOTER ----- */
.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.sidebar-btn {
    flex: 1;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    font-size: 0.65rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 40px;
}

.sidebar-btn:hover {
    background: var(--hover-bg);
    border-color: var(--primary);
}

.sidebar-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ----- PROFILE SECTION ----- */
.profile-section {
    text-align: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--hover-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 6px;
}

.profile-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.profile-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ----- PROFILE PLAN ----- */
.profile-plan {
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
    backdrop-filter: blur(4px);
}

.profile-plan .plan-label {
    font-size: 0.55rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

.profile-plan .plan-name {
    font-size: 0.85rem;
    font-weight: 700;
    display: block;
    margin: 2px 0;
}

.profile-plan .plan-time {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

/* ----- LOGIN FORM ----- */
.login-form {
    padding: 12px 16px;
    flex-shrink: 0;
}

.login-form .form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 8px;
    outline: none;
    transition: all 0.2s;
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
}

.login-form .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 211, 201, 0.1);
}

.login-btn {
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.85rem;
}

.login-btn:hover {
    background: var(--primary-dark);
}

/* ----- USER MENU ----- */
.user-menu {
    padding: 10px 12px;
    flex: 1;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

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

.menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.menu-item.logout {
    color: #EF4444;
    margin-top: 6px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.menu-item.logout:hover {
    background: rgba(239, 68, 68, 0.08);
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 8px;
}

/* ----- PROMPT ITEM ----- */
.prompt-item {
    flex-direction: column;
    align-items: stretch !important;
    padding: 8px 10px !important;
}

.prompt-item textarea {
    font-family: inherit;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.7rem;
    color: var(--text-primary);
    resize: vertical;
    outline: none;
    transition: border 0.2s;
    min-height: 40px;
}

.prompt-item textarea:focus {
    border-color: var(--primary);
}

.prompt-item button {
    padding: 4px 12px;
    border-radius: 6px;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    margin-top: 4px;
    align-self: flex-end;
}

.prompt-item button:hover {
    background: var(--primary-dark);
}

/* ----- OVERLAY ----- */
.overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: 50;
}

.overlay.active {
    display: block;
}

/* ----- TOAST ----- */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 0.8rem;
    color: white;
    background: var(--toast-bg);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    font-family: inherit;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.toast.success { background: #10B981; }
.toast.error { background: #EF4444; }
.toast.info { background: #3B82F6; }

[data-theme="dark"] .toast.success { background: #059669; }
[data-theme="dark"] .toast.error { background: #DC2626; }
[data-theme="dark"] .toast.info { background: #2563EB; }

/* ----- RESPONSIVE ----- */
@media (max-width: 480px) {
    .app-container {
        max-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }
    .sidebar-left,
    .sidebar-right {
        width: 85%;
    }
    .message .bubble {
        max-width: 90%;
        font-size: 0.85rem;
    }
    .header {
        padding: 8px 12px;
        min-height: 48px;
    }
    .chat-area {
        padding: 12px 14px;
    }
    .plan-badge {
        font-size: 0.45rem;
        padding: 1px 8px;
    }
}

/* ============================================================
   MARKDOWN STİLLERİ - DEEPSEEK TARZI
   ============================================================ */

.markdown-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    word-wrap: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.markdown-body h1 { font-size: 1.6em; border-bottom: 2px solid var(--border); padding-bottom: 8px; }
.markdown-body h2 { font-size: 1.35em; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.9em; }
.markdown-body h6 { font-size: 0.85em; color: var(--text-light); }

.markdown-body p {
    margin: 8px 0;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 24px;
    margin: 8px 0;
}

.markdown-body ul ul,
.markdown-body ol ol,
.markdown-body ul ol,
.markdown-body ol ul {
    margin: 4px 0;
}

.markdown-body li {
    margin: 4px 0;
}

.markdown-body li::marker {
    color: var(--primary);
}

.markdown-body blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 4px solid var(--primary);
    background: rgba(123, 211, 201, 0.08);
    border-radius: 0 8px 8px 0;
    color: var(--text-light);
}

.markdown-body code {
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.85em;
    color: #e83e8c;
}

.markdown-body pre {
    margin: 12px 0;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    overflow-x: auto;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.85em;
    line-height: 1.6;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: var(--text);
}

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.markdown-body table th,
.markdown-body table td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.markdown-body table th {
    background: rgba(123, 211, 201, 0.12);
    font-weight: 600;
}

.markdown-body table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.markdown-body strong {
    font-weight: 600;
    color: var(--text);
}

.markdown-body em {
    font-style: italic;
}

.markdown-body del {
    text-decoration: line-through;
    color: var(--text-light);
}

.markdown-body hr {
    margin: 16px 0;
    border: none;
    border-top: 2px solid var(--border);
}

.markdown-body a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.markdown-body a:hover {
    border-bottom-color: var(--primary);
}

/* Koyu tema için */
[data-theme="dark"] .markdown-body code {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .markdown-body pre {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .markdown-body blockquote {
    background: rgba(123, 211, 201, 0.12);
}

[data-theme="dark"] .markdown-body table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .markdown-body table th {
    background: rgba(123, 211, 201, 0.2);
}

/* Bot mesajlarında markdown */
.message.bot .bubble {
    background: rgba(123, 211, 201, 0.1);
    border: 1px solid rgba(123, 211, 201, 0.2);
    padding: 12px 16px;
    border-radius: 12px 12px 12px 4px;
    max-width: 85%;
    font-size: 14px;
}

.message.bot .bubble .time {
    display: block;
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-light);
    text-align: right;
}

/* Loading animation */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

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

.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); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* ============================================================
   TAM EKRAN SOHBET - KUTUCUKSUZ
   ============================================================ */

/* Sohbet alanı - tam ekran */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: transparent;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Mesajlar - tam genişlik */
#messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    width: 100%;
    max-width: 100%;
}

/* Kullanıcı mesajları - sağda, kutu yok */
.message.user {
    align-self: flex-end;
    max-width: 85%;
    margin: 4px 0;
}

.message.user .bubble {
    background: var(--primary);
    color: white;
    padding: 10px 16px;
    border-radius: 16px 16px 4px 16px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: none;
}

.message.user .bubble .time {
    color: rgba(255,255,255,0.7);
    font-size: 0.65rem;
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* Bot mesajları - solda, kutu yok */
.message.bot {
    align-self: flex-start;
    max-width: 92%;
    margin: 4px 0;
}

.message.bot .bubble {
    background: transparent;
    padding: 8px 4px;
    border-radius: 0;
    font-size: 14px;
    line-height: 1.7;
    box-shadow: none;
    border: none;
    max-width: 100%;
}

.message.bot .bubble .markdown-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
}

.message.bot .bubble .time {
    display: block;
    margin-top: 6px;
    font-size: 0.65rem;
    color: var(--text-light);
    text-align: left;
}

/* Mesajlar arası boşluk */
.message {
    margin: 2px 0;
}

/* Welcome mesajı */
.welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.welcome h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text);
}

.welcome p {
    font-size: 0.95rem;
}

/* Input alanı - daha modern */
.input-area {
    padding: 12px 20px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    width: 100%;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    max-width: 100%;
    margin: 0 auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 211, 201, 0.15);
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    outline: none;
    color: var(--text);
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
}

.input-wrapper textarea::placeholder {
    color: var(--text-light);
}


.input-wrapper button:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.input-wrapper button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Markdown stilleri - bot için */
.markdown-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    word-wrap: break-word;
}

.markdown-body h1 {
    font-size: 1.6em;
    font-weight: 700;
    margin: 12px 0 8px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 6px;
    color: var(--text);
}

.markdown-body h2 {
    font-size: 1.3em;
    font-weight: 600;
    margin: 10px 0 6px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
    color: var(--text);
}

.markdown-body h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 8px 0 4px;
    color: var(--text);
}

.markdown-body p {
    margin: 6px 0;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 22px;
    margin: 6px 0;
}

.markdown-body li {
    margin: 3px 0;
}

.markdown-body li::marker {
    color: var(--primary);
}

.markdown-body strong {
    font-weight: 600;
    color: var(--text);
}

.markdown-body em {
    font-style: italic;
}

.markdown-body code {
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.85em;
}

.markdown-body pre {
    margin: 8px 0;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    overflow-x: auto;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
}

.markdown-body blockquote {
    margin: 8px 0;
    padding: 6px 14px;
    border-left: 4px solid var(--primary);
    background: rgba(123, 211, 201, 0.08);
    border-radius: 0 8px 8px 0;
}

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}

.markdown-body table th,
.markdown-body table td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}

.markdown-body table th {
    background: rgba(123, 211, 201, 0.12);
    font-weight: 600;
}

.markdown-body hr {
    margin: 12px 0;
    border: none;
    border-top: 1px solid var(--border);
}

.markdown-body a {
    color: var(--primary);
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

/* Koyu tema */
[data-theme="dark"] .markdown-body code {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .markdown-body pre {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .markdown-body blockquote {
    background: rgba(123, 211, 201, 0.12);
}

[data-theme="dark"] .markdown-body table th {
    background: rgba(123, 211, 201, 0.2);
}

[data-theme="dark"] .markdown-body table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Tüm ekran kaplama için */
.app-container {
    height: 100dvh;
    display: flex;
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg);
}

/* Header - sadeleştir */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.plan-badge {
    font-size: 0.65rem;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.menu-btn,
.profile-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
    color: var(--text);
}

.menu-btn:hover,
.profile-btn:hover {
    background: var(--hover-bg);
}

/* ============================================================
   🔥 INPUT ICON BUTTONS - DÜZELTİLDİ
   ============================================================ */

/* Tüm ikon butonları - şeffaf zemin */
.input-wrapper .icon-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent !important;
    color: var(--text-light);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.input-wrapper .icon-btn:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-primary);
}

.input-wrapper .icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* 🔥 Sadece gönder ve durdur butonları - renkli */
.input-wrapper #sendBtn,
.input-wrapper #stopBtn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--primary) !important;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.input-wrapper #sendBtn:hover,
.input-wrapper #stopBtn:hover {
    background: var(--primary-dark) !important;
    transform: scale(1.05);
}

.input-wrapper #sendBtn svg,
.input-wrapper #stopBtn svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
}

/* 🔥 Durdur butonu kırmızı */
.input-wrapper #stopBtn {
    background: #EF4444 !important;
}

.input-wrapper #stopBtn:hover {
    background: #DC2626 !important;
}

/* 🔥 Input alanı düzeni */
.input-wrapper {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 6px 4px 12px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.2s;
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 4px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    outline: none;
    color: var(--text);
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
}

.input-wrapper textarea::placeholder {
    color: var(--text-light);
    opacity: 0.6;
}

/* File input gizle */
#fileInput {
    display: none !important;
}

/* ============================================================
   📝 MESAJ KUTUSU İYİLEŞTİRMELERİ
   ============================================================ */

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 6px 8px 6px 16px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.2s;
    min-height: 48px;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 211, 201, 0.15);
}

.input-wrapper textarea {
    flex: 1;
    min-width: 80px;
    border: none;
    background: transparent;
    padding: 10px 4px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    outline: none;
    color: var(--text);
    min-height: 24px;
    max-height: 150px;
    line-height: 1.5;
}

.input-wrapper textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
    font-size: 0.9rem;
}

/* 🔥 İkon butonları - optimize */
.input-wrapper .icon-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent !important;
    color: var(--text-light);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.input-wrapper .icon-btn:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-primary);
}

.input-wrapper .icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
}

/* 🔥 Gönder butonu */
.input-wrapper #sendBtn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border: none;
    border-radius: 10px;
    background: var(--primary) !important;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.input-wrapper #sendBtn:hover {
    background: var(--primary-dark) !important;
    transform: scale(1.05);
}

.input-wrapper #sendBtn svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
}

/* 🔥 Durdur butonu */
.input-wrapper #stopBtn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border: none;
    border-radius: 10px;
    background: #EF4444 !important;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.input-wrapper #stopBtn:hover {
    background: #DC2626 !important;
    transform: scale(1.05);
}

.input-wrapper #stopBtn svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
}

/* ============================================================
   🔊 SES DALGALARI İKONU
   ============================================================ */

.sound-waves {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.sound-waves span {
    display: inline-block;
    width: 3px;
    background: currentColor;
    border-radius: 2px;
    transition: height 0.3s ease;
}

.sound-waves span:nth-child(1) { height: 8px; }
.sound-waves span:nth-child(2) { height: 14px; }
.sound-waves span:nth-child(3) { height: 8px; }

.sound-waves:hover span:nth-child(1) { height: 12px; }
.sound-waves:hover span:nth-child(2) { height: 18px; }
.sound-waves:hover span:nth-child(3) { height: 12px; }

/* Aktif (konuşurken) */
.sound-waves.active span {
    animation: wave 0.6s ease-in-out infinite alternate;
}

.sound-waves.active span:nth-child(1) { animation-delay: 0s; }
.sound-waves.active span:nth-child(2) { animation-delay: 0.2s; }
.sound-waves.active span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wave {
    0% { height: 6px; }
    100% { height: 18px; }
}

/* ============================================================
   🖼️ GÖRSEL PREVIEW
   ============================================================ */

.image-preview-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    animation: fadeIn 0.3s ease;
}

.image-preview-container img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.image-preview-container .info {
    font-size: 0.8rem;
    color: var(--text-light);
    flex: 1;
}

.image-preview-container .remove-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.image-preview-container .remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

/* ============================================================
   🖼️ GÖRSEL PREVIEW
   ============================================================ */

.image-preview-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    animation: fadeIn 0.3s ease;
}

.image-preview-container img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.image-preview-container .info {
    font-size: 0.8rem;
    color: var(--text-light);
    flex: 1;
}

.image-preview-container .remove-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.image-preview-container .remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   🖼️ GÖRSEL PREVIEW
   ============================================================ */

.image-preview-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    animation: fadeIn 0.3s ease;
}

.image-preview-container img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.image-preview-container .info {
    font-size: 0.8rem;
    color: var(--text-light);
    flex: 1;
}

.image-preview-container .remove-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.image-preview-container .remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   🎨 PROFİL MENÜ İKONLARI - MODERN
   ============================================================ */

.menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: all 0.2s ease;
}

.menu-item:hover svg {
    stroke: var(--primary);
    transform: scale(1.05);
}

.menu-item.logout svg {
    stroke: #EF4444;
}

.menu-item.logout:hover svg {
    stroke: #DC2626;
}

/* ============================================================
   📝 SİSTEM PROMPTU PANELİ
   ============================================================ */

.prompt-panel {
    animation: slideDown 0.3s ease;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 8px 0;
}

.prompt-panel textarea {
    transition: border-color 0.2s;
}

.prompt-panel textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 211, 201, 0.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   ============================================================ */

/* TÜM EKRAN BOYUTLARINDA butonlar görünsün */
#menuToggle,
#profileToggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 1.5rem !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    color: var(--text-primary, #2D4A44) !important;
    padding: 4px !important;
    flex-shrink: 0 !important;
    z-index: 9999 !important;
    visibility: visible !important;
    opacity: 1 !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
}

/* Mobil (480px ve altı) */
@media (max-width: 480px) {
    
    #menuToggle,
    #profileToggle {
        min-width: 48px !important;
        min-height: 48px !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 1.8rem !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 4px 6px !important;
        min-height: 56px !important;
        width: 100% !important;
        background: var(--bg-secondary, #FFFFFF) !important;
        border-bottom: 1px solid var(--border-color, #D4F0EA) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        gap: 2px !important;
    }
    
    .header-center {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 !important;
        gap: 4px !important;
        min-width: 0 !important;
        overflow: hidden !important;
        padding: 0 2px !important;
    }
    
    .header-center .page-title {
        font-size: 0.7rem !important;
        max-width: 50px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: inline-block !important;
    }
    
    .header-center #versionDisplay {
        font-size: 0.5rem !important;
        white-space: nowrap !important;
    }
    
    .header-center #coachSelector {
        font-size: 0.5rem !important;
        padding: 2px 4px !important;
        max-width: 50px !important;
        border-radius: 4px !important;
        background: var(--bg, #F2FCF9) !important;
        border: 1px solid var(--border-color, #D4F0EA) !important;
        color: var(--text-primary, #2D4A44) !important;
        outline: none !important;
    }
}

/* iPhone/iOS için ekstra güvenlik */
@supports (-webkit-touch-callout: none) {
    #menuToggle,
    #profileToggle {
        min-width: 52px !important;
        min-height: 52px !important;
        width: 52px !important;
        height: 52px !important;
        font-size: 2rem !important;
    }
}

/* Çok küçük ekranlar (380px altı) */
@media (max-width: 380px) {
    #menuToggle,
    #profileToggle {
        min-width: 40px !important;
        min-height: 40px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.3rem !important;
    }
    
    .header-center .page-title {
        font-size: 0.6rem !important;
        max-width: 35px !important;
    }
    
    .header-center #versionDisplay {
        font-size: 0.45rem !important;
    }
    
    .header-center #coachSelector {
        font-size: 0.45rem !important;
        max-width: 35px !important;
        padding: 1px 2px !important;
    }
}

/* ============================================================
   📱 MOBİL - ORTA KISMI DARALT, BUTONLARA YER AÇ!
   ============================================================ */

/* 480px ve altı */
@media (max-width: 480px) {
    
    /* Header - sıkıştır */
    .header {
        padding: 4px 6px !important;
        min-height: 48px !important;
        gap: 2px !important;
    }
    
    /* Orta kısım - daralt */
    .header > div:not(.sidebar-left):not(.sidebar-right) {
        gap: 4px !important;
        padding: 0 2px !important;
        flex: 0 1 auto !important;
    }
    
    /* Versiyon etiketini gizle (sadece numara kalsın) */
    .header > div span:first-child {
        display: none !important;
    }
    
    /* Coach etiketini gizle (sadece select kalsın) */
    .header > div div span:first-child {
        display: none !important;
    }
    
    /* Coach bölümündeki çizgiyi kaldır */
    .header > div div {
        border-left: none !important;
        padding-left: 0 !important;
    }
    
    /* Select'i küçült */
    #coachSelector {
        font-size: 0.5rem !important;
        padding: 2px 4px !important;
        max-width: 50px !important;
    }
    
    /* Versiyon numarasını küçült */
    #versionDisplay {
        font-size: 0.5rem !important;
    }
    
    /* Butonlar - zorla görünür */
    #menuToggle, #profileToggle {
        min-width: 40px !important;
        min-height: 40px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.3rem !important;
        display: flex !important;
        flex-shrink: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* iPhone için */
@supports (-webkit-touch-callout: none) {
    #menuToggle, #profileToggle {
        min-width: 48px !important;
        min-height: 48px !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 1.6rem !important;
    }
}

/* ============================================================
   📱 MOBİL - VERSİYON GİZLİ, COACH GÖRÜNSÜN
   ============================================================ */

@media (max-width: 480px) {
    
    /* HEADER */
    .header {
        padding: 4px 8px !important;
        min-height: 48px !important;
        gap: 4px !important;
    }
    
    /* Menü butonu */
    #menuToggle {
        min-width: 36px !important;
        min-height: 36px !important;
        width: 36px !important;
        height: 36px !important;
        font-size: 1.2rem !important;
        display: flex !important;
        flex-shrink: 0 !important;
    }
    
    /* Profil butonu */
    #profileToggle {
        min-width: 36px !important;
        min-height: 36px !important;
        width: 36px !important;
        height: 36px !important;
        font-size: 1.2rem !important;
        display: flex !important;
        flex-shrink: 0 !important;
    }
    
    /* ORTA KISIM */
    .header-center {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 !important;
        gap: 6px !important;
        min-width: 0 !important;
        overflow: hidden !important;
        padding: 0 4px !important;
    }
    
    /* ============================================
       🔥 VERSİYON BÖLÜMÜ - TAMAMEN GİZLİ
       ============================================ */
    .header-center div:first-child {
        display: none !important;
    }
    
    /* ============================================
       🔥 COACH BÖLÜMÜ - GÖRÜNSÜN
       ============================================ */
    .header-center div:last-child {
        border-left: none !important;
        padding-left: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 3px !important;
    }
    
    /* "Coach" etiketini gizle, sadece select kalsın */
    .header-center div:last-child span:first-child {
        display: none !important;
    }
    
    /* Coach select - okunur boyut */
    .header-center #coachSelector {
        font-size: 0.65rem !important;
        padding: 2px 8px !important;
        max-width: 70px !important;
        border-radius: 4px !important;
        background: var(--bg, #F2FCF9) !important;
        border: 1px solid var(--border-color, #D4F0EA) !important;
        color: var(--text-primary, #2D4A44) !important;
        outline: none !important;
        cursor: pointer !important;
        font-weight: 500 !important;
    }
}

/* iPhone/iOS için */
@supports (-webkit-touch-callout: none) {
    #menuToggle, #profileToggle {
        min-width: 40px !important;
        min-height: 40px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.4rem !important;
    }
}

/* 400px altı */
@media (max-width: 400px) {
    #menuToggle, #profileToggle {
        min-width: 32px !important;
        min-height: 32px !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
    }
    
    .header-center #coachSelector {
        font-size: 0.55rem !important;
        max-width: 55px !important;
        padding: 1px 4px !important;
    }
}

/* ============================================================
   📱 MOBİL - SADECE İHTİYAÇ OLANLAR
   ============================================================ */

@media (max-width: 480px) {
    
    /* HEADER - sıkıştır ama butonlara yer ver */
    .header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 4px 8px !important;
        min-height: 48px !important;
        gap: 4px !important;
        width: 100% !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* SOL MENÜ BUTONU */
    #menuToggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 36px !important;
        min-height: 36px !important;
        width: 36px !important;
        height: 36px !important;
        font-size: 1.2rem !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        color: var(--text-primary, #2D4A44) !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        z-index: 999 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* SAĞ PROFİL BUTONU */
    #profileToggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 36px !important;
        min-height: 36px !important;
        width: 36px !important;
        height: 36px !important;
        font-size: 1.2rem !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        color: var(--text-primary, #2D4A44) !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        z-index: 999 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* ORTA KISIM */
    .header-center {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 !important;
        gap: 6px !important;
        min-width: 0 !important;
        overflow: hidden !important;
        padding: 0 4px !important;
    }
    
    /* ============================================
       VERSİYON BÖLÜMÜ - TAMAMEN GİZLİ
       ============================================ */
    .header-center > div:first-child {
        display: none !important;
    }
    
    /* ============================================
       COACH BÖLÜMÜ - GÖRÜNSÜN
       ============================================ */
    .header-center > div:last-child {
        border-left: none !important;
        padding-left: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 3px !important;
    }
    
    /* "Coach" yazısını gizle */
    .header-center > div:last-child span:first-child {
        display: none !important;
    }
    
    /* Coach select - görünsün */
    #coachSelector {
        font-size: 0.7rem !important;
        padding: 2px 8px !important;
        max-width: 75px !important;
        min-width: 55px !important;
        border-radius: 4px !important;
        background: var(--bg, #F2FCF9) !important;
        border: 1px solid var(--border-color, #D4F0EA) !important;
        color: var(--text-primary, #2D4A44) !important;
        outline: none !important;
        cursor: pointer !important;
        font-weight: 500 !important;
        font-size: 0.65rem !important;
    }
}

/* iPhone/iOS için */
@supports (-webkit-touch-callout: none) {
    #menuToggle, #profileToggle {
        min-width: 40px !important;
        min-height: 40px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.4rem !important;
    }
}

/* 400px altı (çok küçük telefonlar) */
@media (max-width: 400px) {
    #menuToggle, #profileToggle {
        min-width: 32px !important;
        min-height: 32px !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
    }
    #coachSelector {
        font-size: 0.55rem !important;
        max-width: 55px !important;
        min-width: 40px !important;
        padding: 1px 4px !important;
    }
}

/* ============================================================
   📱 TELEFON (DİKEY) - PROFİL VE MENÜ BUTONLARI
   ============================================================ */

@media (max-width: 480px) {
    
    /* HEADER - düzenli */
    .header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 4px 8px !important;
        min-height: 48px !important;
        width: 100% !important;
        gap: 4px !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
        background: var(--bg-secondary, #FFFFFF) !important;
        border-bottom: 1px solid var(--border-color, #D4F0EA) !important;
        position: relative !important;
        z-index: 10 !important;
    }
    
    /* MENU BUTONU - görünsün */
    #menuToggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 40px !important;
        min-height: 40px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.3rem !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        color: var(--text-primary, #2D4A44) !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        z-index: 999 !important;
        visibility: visible !important;
        opacity: 1 !important;
        order: 0 !important;
    }
    
    /* PROFİL BUTONU - kesin görünsün! */
    #profileToggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 40px !important;
        min-height: 40px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.3rem !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        color: var(--text-primary, #2D4A44) !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        z-index: 999 !important;
        visibility: visible !important;
        opacity: 1 !important;
        order: 2 !important;
    }
    
    /* ORTA KISIM - esnek */
    .header-center {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 !important;
        gap: 4px !important;
        min-width: 0 !important;
        overflow: hidden !important;
        padding: 0 2px !important;
        order: 1 !important;
    }
    
    /* VERSİYON BÖLÜMÜ - TAMAMEN GİZLİ */
    .header-center > div:first-child {
        display: none !important;
    }
    
    /* COACH BÖLÜMÜ - görünsün */
    .header-center > div:last-child {
        border-left: none !important;
        padding-left: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 2px !important;
    }
    
    /* "Coach" yazısı - GİZLİ */
    .header-center > div:last-child span:first-child {
        display: none !important;
    }
    
    /* COACH SELECT - görünsün */
    #coachSelector {
        display: inline-block !important;
        font-size: 0.6rem !important;
        padding: 2px 6px !important;
        max-width: 65px !important;
        min-width: 50px !important;
        border-radius: 4px !important;
        background: var(--bg, #F2FCF9) !important;
        border: 1px solid var(--border-color, #D4F0EA) !important;
        color: var(--text-primary, #2D4A44) !important;
        outline: none !important;
        cursor: pointer !important;
        font-weight: 500 !important;
        appearance: auto !important;
        -webkit-appearance: auto !important;
    }
}

/* iPhone/iOS için ekstra */
@supports (-webkit-touch-callout: none) {
    #menuToggle, #profileToggle {
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 1.5rem !important;
    }
}

/* 400px altı (çok küçük telefonlar) */
@media (max-width: 400px) {
    #menuToggle, #profileToggle {
        min-width: 34px !important;
        min-height: 34px !important;
        width: 34px !important;
        height: 34px !important;
        font-size: 1.1rem !important;
    }
    #coachSelector {
        font-size: 0.5rem !important;
        max-width: 50px !important;
        min-width: 40px !important;
        padding: 1px 4px !important;
    }
}

/* ============================================================
   📱 MOBİL - HEADER SIKIŞIKLIĞINI GİDER
   ============================================================ */

@media (max-width: 480px) {
    
    /* HEADER - padding azalt */
    .header {
        padding: 6px 10px !important;
        min-height: 48px !important;
    }
    
    /* "Versiyon" ve "Koç" yazılarını gizle */
    .header-center-mobile-fix .label-text {
        display: none !important;
    }
    
    /* Orta kısım - boşluğu azalt */
    .header-center-mobile-fix {
        gap: 4px !important;
    }
    
    /* Coach kutusu - padding azalt */
    .coach-box {
        padding-left: 4px !important;
        border-left: 1px solid var(--border-color) !important;
    }
    
    /* Coach select - küçült */
    #coachSelector {
        font-size: 0.65rem !important;
        padding: 2px 4px !important;
        max-width: 85px !important;
        min-width: 50px !important;
    }
    
    /* Versiyon numarası - küçült */
    #versionDisplay {
        font-size: 0.7rem !important;
        font-weight: 600 !important;
    }
    
    /* ============================================
       BUTONLAR - KESİN GÖRÜNSÜN
       ============================================ */
    #menuToggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 1.3rem !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        color: var(--text-primary, #2D4A44) !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        z-index: 999 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    #profileToggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 40px !important;
        min-height: 40px !important;
        font-size: 1.3rem !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        color: var(--text-primary, #2D4A44) !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        z-index: 999 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* iPhone/iOS için */
@supports (-webkit-touch-callout: none) {
    #menuToggle, #profileToggle {
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 1.5rem !important;
    }
}

/* 400px altı */
@media (max-width: 400px) {
    #menuToggle, #profileToggle {
        min-width: 34px !important;
        min-height: 34px !important;
        font-size: 1.1rem !important;
    }
    #coachSelector {
        font-size: 0.55rem !important;
        max-width: 65px !important;
        min-width: 40px !important;
        padding: 1px 3px !important;
    }
    #versionDisplay {
        font-size: 0.6rem !important;
    }
}

/* ============================================================
   📱 MOBİL - DİNAMİK YÜKSEKLİK (100dvh)
   ============================================================ */

/* Tüm ekran kaplama için - dinamik yükseklik */
.app-container {
    height: 100dvh !important;
    max-height: 100dvh !important;
}

.main-content {
    height: 100dvh !important;
}

/* Mobilde (480px ve altı) */
@media (max-width: 480px) {
    .app-container {
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    
    .main-content {
        height: 100dvh !important;
        overflow: hidden !important;
    }
    
    /* Chat alanı - esnek ve taşmaz */
    .chat-area {
        flex: 1 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        padding: 12px 14px !important;
    }
    
    /* Input alanı - en altta sabit */
    .input-area {
        flex-shrink: 0 !important;
        padding: 8px 12px 12px 12px !important;
        background: var(--bg-secondary, #FFFFFF) !important;
        border-top: 1px solid var(--border-color, #D4F0EA) !important;
    }
}
