/* ── Ferman AI — Main CSS ───────────────────────────────────────────── */
:root {
  --bg:         #0f0f0f;
  --bg2:        #161616;
  --bg3:        #1e1e1e;
  --border:     #2a2a2a;
  --border2:    #333;
  --text:       #e8e8e8;
  --text2:      #999;
  --text3:      #666;
  --accent:     #2563eb;
  --accent-h:   #1d4ed8;
  --accent-s:   #dbeafe;
  --green:      #22c55e;
  --red:        #ef4444;
  --orange:     #f59e0b;
  --purple:     #8b5cf6;
  --sidebar-w:  260px;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 2px 12px rgba(0,0,0,.4);
}

/* ── Light Tema ─────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:         #f5f5f5;
  --bg2:        #ffffff;
  --bg3:        #f0f0f0;
  --border:     #e0e0e0;
  --border2:    #d0d0d0;
  --text:       #111111;
  --text2:      #555555;
  --text3:      #888888;
  --accent:     #2563eb;
  --accent-h:   #1d4ed8;
  --accent-s:   #dbeafe;
  --shadow:     0 2px 12px rgba(0,0,0,.12);
}
[data-theme="light"] .msg-bubble pre { background: #fdfdfd; color:#0f0f0f }
[data-theme="light"] .msg-bubble code { background: #ff7b0021; } 
[data-theme="light"] .code-header { background: #e9ecef; }

/* ── Tema Toggle Butonu ─────────────────────────────────────────────── */
.theme-toggle {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text2); cursor: pointer; transition: all .15s;
  background: none; border: none;
}
.theme-toggle:hover { background: var(--bg3); color: var(--text); }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
pre, code { font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── Guest Auth Panel ───────────────────────────────────────────────── */
.guest-auth-panel {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: var(--bg); display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 999; padding: 24px;
}
.guest-auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.guest-auth-desc { font-size: 14px; color: var(--text2); text-align: center; max-width: 320px; margin-bottom: 28px; line-height: 1.6; }
.guest-auth-btns { display: flex; gap: 12px; }
.guest-auth-btn { display: inline-flex; align-items: center; justify-content: center; padding: 11px 36px; border-radius: var(--radius-sm); font-weight: 700; font-size: 14px; text-decoration: none; transition: opacity .15s; }
.guest-auth-btn:hover { opacity: .85; }
.guest-auth-btn-primary  { background:#f80 ; color: #fff; }
.guest-auth-btn-secondary { background: var(--bg2); color: var(--text); border: 1px solid var(--border2); }
.guest-auth-about { margin-top: 20px; font-size: 12px; color: var(--text3); text-decoration: none; }
.guest-auth-about:hover { color: var(--text2); }

/* ── Sidebar Guest Panel ─────────────────────────────────────────── */
.sidebar-guest-panel {
  padding: 24px 16px; text-align: center; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.sidebar-guest-panel .guest-auth-logo { margin-bottom: 16px; }
.sidebar-guest-panel .guest-auth-desc { margin-bottom: 24px; }
.sidebar-guest-panel .guest-auth-btns { flex-direction: column; width: 100%; gap: 8px; }
.sidebar-guest-panel .guest-auth-btn { width: 100%; padding: 10px; }
.sidebar-guest-panel .guest-auth-about { margin-top: auto; }

/* ── TV Browser Support ─────────────────────────────────────────── */
@media (min-width: 1920px) and (orientation: landscape) {
  .sidebar-guest-panel .guest-auth-btns { gap: 12px; }
  .sidebar-guest-panel .guest-auth-btn { padding: 14px; font-size: 16px; }
  .sidebar-guest-panel .guest-auth-desc { font-size: 16px; max-width: 400px; }
  
  .auth-page { padding: 40px; }
  .auth-card { max-width: 480px; padding: 48px 40px; }
  .form-group input, .form-group select, .form-group textarea { 
    font-size: 18px; padding: 14px 18px; 
  }
  .btn-primary { padding: 14px 24px; font-size: 16px; }
}

/* ── Auth ──────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 40px 36px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 20px; font-weight: 700; }
.logo-icon { width: 30px; height: 30px; background: linear-gradient(45deg, #ff7800 0%, #ffbf00 100%); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 600; font-style:italic; color: #fff; letter-spacing: -1px; flex-shrink:0; }
.logo-text { font-weight: 800; font-size: 20px; letter-spacing: -0.3px; }
.logo-text em { font-style: normal; color: var(--accent); }
.auth-card h1 { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text2); margin-bottom: 28px; font-size: 13px; }
.auth-footer { text-align: center; color: var(--text2); font-size: 13px; margin-top: 20px; }
.form-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; }

/* ── Forms ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text); outline: none; transition: border .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text3); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn-primary { background: var(--accent); color: #fff; border-radius: var(--radius-sm); padding: 10px 20px; font-weight: 600; transition: background .15s; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 7px 16px; transition: all .15s; }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; border-radius: var(--radius-sm); padding: 7px 16px; font-weight: 600; transition: background .15s; }
.btn-danger:hover { background: #dc2626; }
.btn-full { width: 100%; }
.btn-icon { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text2); transition: all .15s; }
.btn-icon:hover { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Layout ────────────────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
  transition: margin-left .25s ease, opacity .25s ease;
}
.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-w));
  opacity: 0; pointer-events: none;
}
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 16px; margin-bottom: 12px; }
.new-chat-btn {
  width: 100%; padding: 9px 14px; background: var(--accent); color: #fff;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 6px; justify-content: center;
  transition: background .15s; border: none; cursor: pointer;
}
.new-chat-btn:hover { background: var(--accent-h); }
.search-box { position: relative; margin-top: 10px; }
.search-box input {
  width: 100%; padding: 8px 12px 8px 32px; background: var(--bg3);
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 14px; pointer-events: none; }
.chat-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-group-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .8px; padding: 8px 8px 4px; font-weight: 600; }
.chat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .12s; position: relative;
}
.chat-item:hover { background: var(--bg3); }
.chat-item.active { background: var(--bg3); border-left: 2px solid var(--accent); }
.chat-item-text { flex: 1; min-width: 0; }
.chat-item-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.chat-item-sub { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-actions { display: none; gap: 2px; }
.chat-item:hover .chat-item-actions { display: flex; }
.sidebar-footer { border-top: 1px solid var(--border); padding: 12px 14px; }
.sidebar-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.sidebar-socials { display: flex; align-items: center; gap: 4px; }
.sidebar-socials a { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-sm); color: var(--text3); transition: all .15s; }
.sidebar-socials a:hover { background: var(--bg3); color: var(--text); }
.user-card { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 8px 10px; border-radius: var(--radius-sm); transition: background .15s; }
.user-card:hover { background: var(--bg3); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: 11px; color: var(--text3); }
/* ── User Popup Menu ────────────────────────────────────────────────── */
.user-menu-wrap { position: relative; }
.user-popup {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; z-index: 200;
}
.user-popup-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; font-size: 13px; color: var(--text2);
  transition: background .12s, color .12s; cursor: pointer;
}
.user-popup-item:hover { background: var(--bg3); color: var(--text); }


/* ── Guest Auth Buttons ────────────────────────────────────────────── */
.guest-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}

.guest-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.guest-btn:hover::before {
  opacity: 1;
}

.guest-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.guest-btn span {
  flex: 1;
  text-align: center;
}

.guest-btn svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.guest-btn:hover svg {
  transform: translateX(4px);
}

.guest-btn-login {
  background: linear-gradient(135deg, #ff8c00 0%, #ff6600 100%);
  color: #ffffff;
}

.guest-btn-login:hover {
  background: linear-gradient(135deg, #ff9500 0%, #ff7700 100%);
}

.guest-btn-register {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  color: #ffffff;
}

.guest-btn-register:hover {
  background: linear-gradient(135deg, #a569c7 0%, #9b4fbe 100%);
}

/* ── Auth Page Gradient Buttons ────────────────────────────────── */
.auth-gradient-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.auth-gradient-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-gradient-btn:hover::before {
  opacity: 1;
}

.auth-gradient-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.auth-gradient-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-gradient-btn span {
  flex: 1;
  text-align: center;
}

.auth-gradient-btn svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.auth-gradient-btn:hover svg {
  transform: translateX(4px);
}

.auth-btn-login {
  background: linear-gradient(135deg, #ff8c00 0%, #ff6600 100%);
  color: #ffffff;
}

.auth-btn-login:hover {
  background: linear-gradient(135deg, #ff9500 0%, #ff7700 100%);
}

.auth-btn-register {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  color: #ffffff;
}

.auth-btn-register:hover {
  background: linear-gradient(135deg, #a569c7 0%, #9b4fbe 100%);
}

/* ── Main ──────────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--border); min-height: 54px; }
.chat-header-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header-actions { display: flex; align-items: center; gap: 4px; }
.messages { flex: 1; overflow-y: auto; padding: 24px 20px; }
.empty-state { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.empty-state h2 { font-size: 22px; font-weight: 700; color: var(--text); }
.empty-state p { color: var(--text2); font-size: 14px; max-width: 360px; text-align: center; }
.empty-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.suggestion-chip { padding: 8px 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: 20px; font-size: 13px; cursor: pointer; color: var(--text2); transition: all .15s; }
.suggestion-chip:hover { border-color: var(--accent); color: var(--text); }

/* ── Messages ──────────────────────────────────────────────────────── */
.msg { display: flex; gap: 12px; margin-bottom: 20px; animation: fadeUp .2s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.msg.user { flex-direction: row-reverse; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.msg.user .msg-avatar { background: var(--accent); color: #fff; }
.msg.assistant .msg-avatar { background: var(--bg3); border: 1px solid var(--border); color: var(--text); }
.msg-content { max-width: 72%; }
.msg.user .msg-content { align-items: flex-end; }
.msg-bubble {
  padding: 12px 16px; border-radius: 12px; line-height: 1.65; font-size: 14px;
  max-width: 100%; word-wrap: break-word; word-break: break-word;
  user-select: text;
  max-height: 720px;
  overflow-y: auto;
}
.msg.user .msg-bubble { background: #ce5e5e; color: #ffffff; border-bottom-right-radius: 4px; }
.msg.assistant .msg-bubble { background: var(--bg2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-bubble.collapsible { position: relative; padding-right: 32px; min-width:300px;}
.bubble-preview { display: block; min-width: 120px; }
.bubble-full { display: none; position: relative; min-width: 120px; }
.bubble-toggle-icon { 
  position: sticky; top: 8px; 
  width: 20px; height: 20px; 
  background: var(--bg3); border: 1px solid var(--border2); 
  border-radius: 4px; color: var(--text2); 
  font-size: 12px; cursor: pointer; 
  transition: all 0.2s; z-index: 10;
  float: right; margin: 0 0 8px 8px;
  flex-shrink: 0;
}
.bubble-toggle-icon:hover { background: var(--accent); color: #fff; transform: scale(1.1); }
.msg-actions { display: flex; align-items: center; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions { opacity: 1; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.msg-file-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--bg3); border: 1px solid var(--border); border-radius: 20px; font-size: 12px; color: var(--text2); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.user .msg-file-tag { background: white; border-color: rgba(255,255,255,.25); color:grey; }
[data-theme="light"] .msg-file-tag { background: #f0f0f0; border-color: #ddd; }
.msg.user .msg-actions { justify-content: flex-end; }
.msg-action { padding: 4px 6px; border-radius: 4px; font-size: 12px; color: var(--text3); display: flex; align-items: center; gap: 3px; transition: all .15s; }
.msg-action:hover { background: var(--bg3); color: var(--text); }
.msg-action.liked { color: var(--green); }
.msg-action.disliked { color: var(--red); }
.msg-action.tts-active { color: var(--accent); animation: tts-pulse 1s ease-in-out infinite; }
.msg-action.tts-active ~ .msg-action, .msg .msg-actions:has(.tts-active) { opacity: 1; }
@keyframes tts-pulse { 0%,100% { opacity:1; } 50% { opacity:.5; } }
@media (max-width: 768px) { .msg-actions { opacity: 1; } }

/* ── Markdown ──────────────────────────────────────────────────────── */
.msg-bubble h1,.msg-bubble h2,.msg-bubble h3 { margin: 12px 0 6px; line-height: 1.3; }
.msg-bubble h1 { font-size: 18px; } .msg-bubble h2 { font-size: 16px; } .msg-bubble h3 { font-size: 14px; }
.msg-bubble p { margin-bottom: 10px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { margin: 8px 0 8px 20px; }
.msg-bubble li { margin-bottom: 4px; }
.msg-bubble code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.msg-bubble pre { background: #0d1117; border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin: 10px 0; overflow-x: auto; position: relative; }
.msg-bubble pre code { background: none; padding: 4px; font-size: 13px; }
.code-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: #161b22; border-radius: 8px 8px 0 0; border: 1px solid var(--border); border-bottom: none; }
.code-lang { font-size: 11px; color: var(--text3); text-transform: uppercase; }
.copy-code-btn { font-size: 11px; color: var(--text3); cursor: pointer; }
.copy-code-btn:hover { color: var(--text); }
.msg-bubble blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--text2); margin: 10px 0; }
.msg-bubble strong { font-weight: 700; }
.msg-bubble em { font-style: italic; }
.msg-bubble table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.msg-bubble th, .msg-bubble td { border: 1px solid var(--border2); padding: 7px 12px; text-align: left; }
.msg-bubble th { background: var(--bg3); font-weight: 600; }
.msg-bubble hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ── Typing indicator ──────────────────────────────────────────────── */
.typing-dots { display: flex; align-items: center; gap: 4px; padding: 4px 0; }
.typing-dots span { width: 7px; height: 7px; background: var(--text3); border-radius: 50%; animation: blink 1.4s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }
.typing-status { font-size: 13px; color: var(--accent); padding: 4px 0; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

/* ── Input Area ────────────────────────────────────────────────────── */
.input-area { padding: 12px 12px 12spx; border-top: 1px solid var(--border); text-align: -webkit-center;}
.input-box { background: var(--bg2); border: 1px solid var(--border2); border-radius: 14px; padding: 8px 10px; display: flex; align-items: flex-end; gap: 8px; transition: border .15s; max-width: 960px; }
.input-box:focus-within { border-color: var(--accent); }
.input-box textarea { flex: 1; background: none; border: none; color: var(--text); resize: none; outline: none; min-height: 24px; max-height: 160px; font-size: 14px; }
.input-box textarea::placeholder { color: var(--text3); }
.input-tools { display: flex; align-items: center; gap: 4px; }
.input-tool-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--text3); display: flex; align-items: center; justify-content: center; transition: all .15s; }
.input-tool-btn:hover { background: var(--bg3); color: var(--text); }
.send-btn { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; transition: background .15s; flex-shrink: 0; }
.send-btn:hover:not(:disabled) { background: var(--accent-h); }
.send-btn:disabled { opacity: .4; cursor: default; }
.input-info { display: content; align-items: center; justify-content: space-between; padding: 6px 2px 0; font-size: 11px; color: var(--text3); }

/* ── File Attachments ──────────────────────────────────────────────── */
.attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 2px; }
.attachment { display: flex; align-items: center; gap: 6px; padding: 5px 10px; margin: 3px 5px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text2); }
.attachment-remove { color: var(--text3); cursor: pointer; transition: color .15s; }
.attachment-remove:hover { color: var(--red); }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-file { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: rgba(255,255,255,.06); border-radius: 6px; font-size: 12px; cursor: pointer; }
.msg-img { max-width: 240px; max-height: 240px; border-radius: 8px; cursor: pointer; margin-top: 8px; }

/* ── Dashboard Layout ──────────────────────────────────────────────── */
.dashboard { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.dashboard-header { padding: 20px 28px 0; border-bottom: 1px solid var(--border); }
.dashboard-header-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.dashboard-header h1 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.dashboard-tabs { display: flex; gap: 0; }
.dashboard-menu-btn { display: none; padding: 6px; border-radius: var(--radius-sm); color: var(--text2); transition: all .15s; flex-shrink: 0; }
.dashboard-menu-btn:hover { background: var(--bg3); color: var(--text); }
.tab-link { padding: 10px 16px; font-size: 13px; color: var(--text2); border-bottom: 2px solid transparent; transition: all .15s; cursor: pointer; }
.tab-link.active, .tab-link:hover { color: var(--text); border-bottom-color: var(--accent); }
.dashboard-content { flex: 1; overflow-y: auto; padding: 28px; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-title { font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.card-value { font-size: 28px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }

/* ── Tables ─────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text2); font-weight: 600; text-align: left; white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg3); }
.data-table tr:last-child td { border-bottom: none; }

/* ── Badge ──────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green { background: rgba(34,197,94,.15); color: var(--green); }
.badge-red   { background: rgba(239,68,68,.15); color: var(--red); }
.badge-blue  { background: rgba(37,99,235,.15); color: #60a5fa; }
.badge-gray  { background: rgba(150,150,150,.15); color: var(--text2); }
.badge-purple { background: rgba(139,92,246,.15); color: #a78bfa; }

/* ── Plan Cards ─────────────────────────────────────────────────────── */
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .plans-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .plans-grid { grid-template-columns: 1fr; } }
.plans-top-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }
@media (max-width: 900px) { .plans-top-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .plans-top-row { grid-template-columns: 1fr; } }
.plan-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 22px 22px; position: relative; margin-top: 12px; display: flex; flex-direction: column; }
.plan-card.current { border-color: var(--accent); }
.plan-card.popular { border-color: var(--accent); }
.plan-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 12px; border-radius: 20px; white-space: nowrap; }
.plan-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.plan-price { font-size: 32px; font-weight: 800; margin: 12px 0 4px; }
.plan-period { font-size: 13px; color: var(--text2); }
.plan-features { list-style: none; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.plan-features li { font-size: 13px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.plan-features li::before { content: '✓'; color: var(--green); font-weight: 700; }
.plan-card-big { padding: 32px 24px 24px; }
.plan-card-big .plan-name { font-size: 20px; }
.plan-card-big .plan-price { font-size: 36px; }

/* ── Payment ────────────────────────────────────────────────────────── */
.payment-tab-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border2); background: var(--bg2);
  color: var(--text2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.payment-tab-btn:hover { border-color: var(--accent); color: var(--text); }
.payment-tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.payment-info-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.payment-info-row:last-child { border-bottom: none; }
.payment-info-row > span:first-child { color: var(--text3); min-width: 100px; }

/* ── API Key ────────────────────────────────────────────────────────── */
.api-key-display { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm); font-family: monospace; font-size: 13px; }
.api-key-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { padding: 12px 18px; background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-sm); font-size: 13px; color: var(--text); box-shadow: var(--shadow); animation: slideIn .2s ease; min-width: 240px; max-width: 340px; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 480px; padding: 28px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { color: var(--text2); font-size: 20px; transition: color .15s; }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ── Progress Bar ───────────────────────────────────────────────────── */
.progress { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.progress-bar.warn { background: var(--orange); }
.progress-bar.danger { background: var(--red); }

/* ── Admin Sidebar ──────────────────────────────────────────────────── */
.admin-layout { display: flex; height: 100vh; overflow: hidden; }
.admin-sidebar { width: 220px; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.admin-sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.admin-sidebar-header h2 { font-size: 14px; font-weight: 700; color: var(--text2); }
.admin-nav { flex: 1; padding: 8px; overflow-y: auto; }
.admin-nav a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text2); font-size: 13px; transition: all .15s; margin-bottom: 2px; }
.admin-nav a:hover, .admin-nav a.active { background: var(--bg3); color: var(--text); }
.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.admin-content { flex: 1; overflow-y: auto; padding: 28px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 28px; border-bottom: 1px solid var(--border); }
.admin-topbar h1 { font-size: 17px; font-weight: 700; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-card-label { font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.stat-card-value { font-size: 26px; font-weight: 800; }
.stat-card-change { font-size: 12px; color: var(--text3); margin-top: 4px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--red); }

/* ── Shared Chat ────────────────────────────────────────────────────── */
.shared-page { max-width: 740px; margin: 0 auto; padding: 40px 20px; }
.shared-header { text-align: center; margin-bottom: 32px; }
.shared-header h1 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.shared-header p { color: var(--text2); font-size: 13px; }

/* ── Sidebar Overlay (mobil) ─────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 99; cursor: pointer;
}
.sidebar-overlay.active { display: block; }

/* ── Welcome Topbar ────────────────────────────────────────────────── */
.welcome-topbar { display: none; width: 100%; padding: 10px 14px; }
.welcome-menu-btn { display: none; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100; transform: translateX(-100%);
    transition: none; width: 280px;
  }
  .sidebar.animated { transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }

  /* Main içerik tam genişlik */
  .main { min-width: 0; width: 100%; }

  /* Welcome screen hamburger */
  .welcome-topbar { display: flex; align-items: center; width: 100%; border-bottom: 1px solid var(--border); }
  .welcome-menu-btn { display: flex; align-items: center; justify-content: center; }

  /* Chat header */
  .chat-header { padding: 10px 14px; }
  .chat-header-title { font-size: 14px; max-width: 160px; }

  /* Mesajlar */
  .messages { padding: 16px 12px; }
  .msg-content { max-width: 92%; }
  .msg-bubble { font-size: 13px; padding: 10px 13px; }

  /* Input area */
  .input-area { padding: 8px 10px 10px; }
  .input-box { gap: 6px; }

  /* Guest buttons mobil */
  .guest-btn { padding: 12px 18px; font-size: 13px; }
  .guest-btn svg { width: 14px; height: 14px; }

  /* Dashboard */
  .dashboard { padding: 0; }
  .dashboard-header { padding: 14px 14px 0; }
  .dashboard-header h1 { font-size: 18px; margin-bottom: 0; }
  .dashboard-menu-btn { display: flex; align-items: center; justify-content: center; }
  .dashboard-content { padding: 14px; }
  .dashboard-tabs { gap: 2px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .tab-link { font-size: 12px; padding: 6px 10px; white-space: nowrap; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .card { padding: 14px; }
  .plans-grid { grid-template-columns: 1fr; }

  /* Form overflow */
  .form-group input, .form-group select, .form-group textarea {
    font-size: 16px; /* iOS zoom'u engelle */
  }

  /* Modal */
  .modal { padding: 20px 16px; max-width: 100%; margin: 0 10px; }
  .modal-footer { flex-direction: column; gap: 8px; }
  .modal-footer button { width: 100%; text-align: center; }

  /* Admin panel */
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .admin-nav { display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 4px 8px; gap: 4px; }
  .admin-nav a { white-space: nowrap; padding: 7px 10px; font-size: 12px; margin-bottom: 0; }
  .admin-content { padding: 16px; }
  .admin-topbar { padding: 12px 16px; }

  /* Tablo */
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .card .table-wrap, .card { overflow-x: auto; }
  .api-key-display { flex-direction: column; align-items: flex-start; gap: 6px; }
  .api-key-value { word-break: break-all; font-size: 11px; }
  code { word-break: break-all; }

  /* Auth */
  .auth-card { padding: 28px 20px; }

  /* Shared page */
  .shared-page { padding: 24px 14px; }

  /* User popup */
  .sidebar { overflow: visible; }
  .sidebar-footer { overflow: visible; position: relative; }
  .user-menu-wrap { overflow: visible; }
  .user-popup {
    position: fixed; bottom: 70px; left: 10px; right: 10px;
    border-radius: var(--radius);
    max-height: 70vh; overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0,0,0,.4);
    z-index: 300;
  }
}

/* ── Profil Switcher ───────────────────────────────────────────────────────── */
#profileSwitcher {
  margin: 6px 4px;
}

.profile-switcher-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  border: 1px solid var(--border2);
  background: var(--bg3);
}
.profile-switcher-bar:hover { background: var(--bg2); }

.ps-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ps-avatar.sm { width: 24px; height: 24px; }

.ps-emoji {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.ps-emoji.sm { width: 24px; height: 24px; }
.ps-emoji.lg { width: 72px; height: 72px; }

.ps-info { flex: 1; min-width: 0; }
.ps-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-sub  { font-size: 10px; color: var(--text3); }

.profile-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 350;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  padding: 4px 0;
  min-width: 200px;
}

.pm-label {
  padding: 6px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text3);
}

.pm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.pm-item:hover { background: var(--bg3); color: var(--text); }
.pm-item.active { color: var(--accent); }

.pm-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pm-pin-btn,
.pm-edit-btn {
  display: none;
  opacity: .7;
}
.pm-item:hover .pm-pin-btn  { display: flex; }
.pm-item:hover .pm-edit-btn { display: flex; margin-left: auto; }

.pm-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Proje Bölümü ──────────────────────────────────────────────────────────── */
.sidebar-section-label {
  padding: 14px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
}

.project-list {
  padding: 2px 6px 4px;
}

.project-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--text3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.project-add-btn:hover { background: var(--bg3); color: var(--text2); }

.project-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  transition: background .15s;
  position: relative;
}
.project-item:hover { background: var(--bg3); }
.project-item.active { background: var(--bg3); color: var(--text); }

.project-color-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.project-icon { font-size: 14px; flex-shrink: 0; }
.project-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-count {
  font-size: 10px;
  color: var(--text3);
  background: var(--bg2);
  border-radius: 8px;
  padding: 1px 6px;
  flex-shrink: 0;
}
.project-actions {
  display: none;
  gap: 2px;
  flex-shrink: 0;
}
.project-item:hover .project-actions { display: flex; }
.project-item:hover .project-count   { display: none; }

/* Sohbet satırında proje renk noktası */
.chat-proj-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Projeye taşı açılır menüsü */
.chat-project-menu {
  position: absolute;
  z-index: 400;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  min-width: 180px;
  padding: 4px 0;
}
.cpm-title {
  padding: 6px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
}
.cpm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: background .12s;
}
.cpm-item:hover { background: var(--bg3); color: var(--text); }
.cpm-item.cpm-active { color: var(--accent); }

/* Modal footer düzeni */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

/* ── Code Blocks ───────────────────────────────────────────────────── */
.code-block-wrapper {
  margin: 12px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg3);
  border: 1px solid var(--border2);
  position: relative;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.copy-code-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

.code-block-wrapper pre {
  margin: 0;
  padding: 12px;
  background: transparent;
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
}

.code-block-wrapper code {
  background: transparent;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

/* ── Toast Notifications ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
  min-width: 200px;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-message {
  font-size: 13px;
  font-weight: 500;
}

/* ── Share Dropdown ───────────────────────────────────────────── */
.share-dropdown {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 180px;
  padding: 8px 0;
  z-index: 1000;
}

.share-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
  font-size: 13px;
}

.share-dropdown-item:hover {
  background: var(--bg3);
  color: var(--accent);
}

.share-dropdown-item svg {
  flex-shrink: 0;
}

.share-dropdown-divider {
  height: 1px;
  background: var(--border2);
  margin: 4px 0;
}
