/* nexusmotorsusa.com — admin panel */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --navy: #0b1020; --blue: #2f6bff; --cyan: #00c2ff; --line: #e4e9f2; --mut: #5b6b85; --bg: #f6f8fc; }
body.admin { font-family: "Segoe UI", system-ui, sans-serif; display: flex; min-height: 100vh; background: var(--bg); color: #1b2333; }
a { color: var(--blue); text-decoration: none; }

.brand-badge { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan)); }
.brand-badge.big { width: 84px; height: 84px; font-size: 46px; border-radius: 22px; margin: 0 auto 18px; box-shadow: 0 12px 34px rgba(47,107,255,.45); }

/* sidebar */
.side { width: 220px; background: var(--navy); color: #b9c6e2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.side nav { display: flex; flex-direction: column; padding: 10px; gap: 2px; flex: 1; }
.side nav a { color: #b9c6e2; padding: 11px 14px; border-radius: 9px; font-size: 14.5px; font-weight: 600; }
.side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: #e67e22; color: #fff; font-size: 11.5px; font-weight: 800; line-height: 1; vertical-align: 1px; }
.side-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.side-foot a { color: #b9c6e2; }

/* main */
.main { flex: 1; padding: 34px 40px; max-width: 1100px; }
.main h1 { margin-bottom: 20px; color: var(--navy); }
.main h2 { margin: 26px 0 12px; color: var(--navy); font-size: 20px; }
.crumb { font-size: 13px; }
.muted { color: var(--mut); }
.page-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.stat-n { font-size: 30px; font-weight: 800; color: var(--navy); }
.stat-l { color: var(--mut); font-size: 13px; }
.stat-hot .stat-n { color: #e67e22; }
.quick-actions { display: flex; gap: 12px; margin-bottom: 10px; }

/* buttons + forms */
.btn { display: inline-block; padding: 10px 20px; border-radius: 9px; border: 0; cursor: pointer; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan)); text-decoration: none !important; }
.btn-ghost { background: rgba(47,107,255,.1); color: var(--blue); }
.btn-small { padding: 5px 12px; font-size: 12.5px; }
.link-danger { background: none; border: 0; color: #d64550; cursor: pointer; font-size: 13.5px; padding: 0; text-decoration: underline; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--mut); margin-top: 12px; }
input, select, textarea { width: 100%; margin-top: 4px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.check-label { display: flex; align-items: center; gap: 8px; margin-top: 26px; }
.check-label input { width: auto; margin: 0; }
.car-form .btn, .settings-form .btn { margin-top: 20px; }
.settings-form { max-width: 760px; }
.error { background: #fdecec; border: 1px solid #f5b5b5; color: #b3261e; padding: 11px 14px; border-radius: 9px; margin: 12px 0; font-size: 14px; }
.ok-note { background: #e8f9ee; border: 1px solid #b7ebc8; color: #1e7d3d; padding: 11px 14px; border-radius: 9px; margin: 12px 0; font-size: 14px; }

/* tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--mut); background: var(--bg); }
.table th, .table td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.table tr.unread { background: #fffbe9; }
.msg-cell { max-width: 340px; }
.row-actions { display: flex; gap: 12px; align-items: center; }
.row-actions form { display: inline; }
.pill { padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill-available { background: #e8f9ee; color: #1e7d3d; }
.pill-pending { background: #fff3e2; color: #b26a00; }
.pill-sold { background: #ececf3; color: #555; }
.pill-hidden { background: #fdecec; color: #b3261e; }
.pill-open { background: #e8f9ee; color: #1e7d3d; }
.pill-closed { background: #ececf3; color: #555; }

/* support tickets */
.ticket-tabs { display: flex; gap: 8px; margin: 6px 0 18px; flex-wrap: wrap; }
.ticket-tabs a { padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--mut); text-decoration: none; }
.ticket-tabs a.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.tab-spam.active { background: #b3261e; border-color: #b3261e; }
.pill-spam { background: #fdecec; color: #b3261e; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--blue); text-decoration: underline; }
.linkbtn-mut { color: var(--mut); }
.linkbtn:hover { color: #b3261e; }
.ticket-grid { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: start; margin-top: 8px; }
.ticket-main { display: flex; flex-direction: column; gap: 14px; }
.ticket-msg { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: #fff; }
.ticket-customer { border-left: 3px solid var(--blue); }
.ticket-reply { border-left: 3px solid #e67e22; background: var(--bg); margin-left: 28px; }
.ticket-meta { font-size: 12.5px; color: var(--mut); margin-bottom: 6px; }
.ticket-car { font-size: 13px; margin-bottom: 8px; }
.ticket-msg p { white-space: pre-wrap; font-size: 14.5px; margin: 0; }
.ticket-replyform { margin-top: 6px; }
.ticket-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; }
.ticket-card h3 { font-size: 14px; margin-bottom: 8px; font-style: italic; }
.ticket-card p { font-size: 14px; margin: 3px 0; }
.status-btns { display: flex; flex-direction: column; gap: 8px; }
.status-btns .btn { width: 100%; }
@media (max-width: 820px) { .ticket-grid { grid-template-columns: 1fr; } .ticket-reply { margin-left: 0; } }

/* photos */
.photo-grid { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0; }
.photo-item img { width: 130px; height: 98px; object-fit: cover; border-radius: 9px; display: block; }
.photo-item { text-align: center; }
.upload-form { margin-top: 10px; display: flex; gap: 12px; align-items: center; }
.upload-form input { width: auto; }

/* bilingual EN/TR text blocks */
.bi-en, .bi-tr { display: block; }
.bi-en { position: relative; }
.bi-tr { margin-top: 4px; color: var(--mut); }
.error .bi-tr, .shell-toggle .bi-tr { margin-top: 3px; }
.intro-bi .bi-en::before, .intro-bi .bi-tr::before {
  font-size: 10px; font-weight: 800; letter-spacing: .5px; color: #fff; background: var(--blue);
  border-radius: 4px; padding: 1px 5px; margin-right: 7px; vertical-align: 2px;
}
.intro-bi .bi-en::before { content: "EN"; }
.intro-bi .bi-tr::before { content: "TR"; background: #e67e22; }

/* chat — 3 columns on this page: sessions | conversation | Turkish guide */
.main:has(.chat-help) { max-width: 1480px; }
.chatwrap { display: grid; grid-template-columns: 220px minmax(0, 1fr) 380px; gap: 18px; align-items: start; margin-top: 14px; }

/* Turkish how-to guide panel */
.chat-help { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; max-height: 660px; overflow-y: auto; font-size: 13.5px; line-height: 1.5; color: #33405a; }
.chat-help h2 { font-size: 16px; color: var(--navy); margin: 0 0 8px; }
.chat-help h3 { font-size: 13.5px; color: var(--navy); margin: 16px 0 6px; }
.chat-help p { margin: 0 0 7px; }
.chat-help .help-lead { color: var(--mut); }
.help-ex { background: #eef4ff; border-left: 3px solid var(--blue); border-radius: 6px; padding: 6px 10px; margin: 5px 0; font-style: italic; color: #274690; }
.chat-help .help-note { font-size: 12px; color: var(--mut); margin: 3px 0 7px; }
.chat-help .help-warn { background: #fdf1ef; border-left: 3px solid #d64550; color: #8f2f24; border-radius: 6px; padding: 9px 11px; font-size: 12.5px; }
.chat-help .help-tip { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--mut); }

/* below 1280px the guide drops under the chat and spans full width */
@media (max-width: 1280px) {
  .chatwrap { grid-template-columns: 220px minmax(0, 1fr); }
  .chat-help { grid-column: 1 / -1; max-height: none; }
}
.chat-side { display: flex; flex-direction: column; gap: 10px; }
.chat-side .btn { width: 100%; }
.chat-list { display: flex; flex-direction: column; gap: 4px; max-height: 520px; overflow-y: auto; }
.chat-item { display: flex; align-items: center; gap: 6px; padding: 9px 11px; border-radius: 9px; background: #fff; border: 1px solid var(--line); cursor: pointer; font-size: 13.5px; }
.chat-item:hover { border-color: var(--blue); }
.chat-item.active { background: rgba(47,107,255,.08); border-color: var(--blue); font-weight: 600; }
.chat-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-del { border: 0; background: none; color: var(--mut); font-size: 16px; cursor: pointer; padding: 0 3px; line-height: 1; }
.chat-item-del:hover { color: #d64550; }
/* shell access toggle */
.shell-toggle { display: flex; align-items: center; gap: 11px; padding: 9px 13px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; color: var(--mut); }
.shell-toggle.on { border-color: #e0776f; background: #fdf1ef; color: #8f2f24; }
.shell-toggle-text strong { color: #1b2333; }
.shell-toggle.on .shell-toggle-text strong { color: #8f2f24; }
.shell-warn { display: none; margin-left: 8px; font-weight: 700; color: #b3261e; }
.shell-toggle.on .shell-warn { display: inline; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; margin: 0; }
.switch .slider { position: absolute; inset: 0; cursor: pointer; background: #c7cfdd; border-radius: 999px; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: #d64550; }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: .5; cursor: not-allowed; }
.attach-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.attach-bar:empty { display: none; }
.attach-chip { display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; }
.attach-chip button { border: 0; background: none; color: var(--mut); font-size: 14px; cursor: pointer; padding: 0; line-height: 1; }
.attach-chip button:hover { color: #d64550; }
.attach-btn { display: flex; align-items: center; justify-content: center; width: 42px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; font-size: 17px; margin: 0; }
.attach-btn:hover { border-color: var(--blue); }
.attach-btn input { display: none; }
.chat-atts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 6px; }
.chat-att-img { width: 92px; height: 70px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.chat-att-doc { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; }
@media (max-width: 820px) { .chatwrap { grid-template-columns: 1fr; } .chat-list { flex-direction: row; flex-wrap: wrap; max-height: none; } }
.chat-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; height: 480px; overflow-y: auto; padding: 18px; margin: 0 0 12px; }
.chat-msg { max-width: 78%; padding: 11px 15px; border-radius: 13px; margin-bottom: 10px; font-size: 14.5px; white-space: pre-wrap; }
.chat-user { background: linear-gradient(135deg, var(--blue), var(--cyan)); color: #fff; margin-left: auto; }
.chat-ai { background: var(--bg); border: 1px solid var(--line); }
.chat-actions { font-size: 12px; color: var(--mut); margin: -4px 0 10px 4px; }
.chat-form { display: flex; gap: 10px; }
.chat-form input { margin: 0; flex: 1; }
.chat-thinking { color: var(--mut); font-style: italic; }

/* login */
.login-body {
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #0b1020;
  background-image: radial-gradient(ellipse 80% 60% at 70% -10%, rgba(56,120,255,.28), transparent);
}
.login-card { width: min(400px, 92vw); background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.09); border-radius: 20px; padding: 44px 38px; text-align: center; color: #e8ecf5; }
.login-card h1 { font-size: 22px; letter-spacing: 4px; }
.login-sub { font-size: 12px; color: #9fb0cc; text-transform: uppercase; letter-spacing: 2px; margin-top: 4px; }
.login-card label { text-align: left; color: #9fb0cc; }
.login-card input { background: rgba(10,16,32,.6); border: 1px solid rgba(255,255,255,.12); color: #e8ecf5; }
.login-card button { width: 100%; margin-top: 24px; padding: 13px; border: 0; border-radius: 10px; font-weight: 700; font-size: 15px; color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--blue), var(--cyan)); }
.login-card .error { background: rgba(255,70,90,.12); border-color: rgba(255,70,90,.35); color: #ff8b9a; }

@media (max-width: 820px) {
  body.admin { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 20px; }
  .stat-grid, .form-grid { grid-template-columns: 1fr 1fr; }
}
