* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", Tahoma, "Noto Kufi Arabic", Arial, sans-serif; background: #f0f2f5; color: #1c1e21; }
body[dir="rtl"] { direction: rtl; }
body[dir="ltr"] { direction: ltr; }
header { background: linear-gradient(135deg, #0f766e, #115e59); color: #fff; padding: 18px 24px; }
header h1 { font-size: 22px; }
header p { font-size: 13px; opacity: .85; margin-top: 4px; }
nav { background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; gap: 4px; padding: 0 24px; }
nav a { padding: 12px 18px; text-decoration: none; color: #4b5563; font-size: 15px; border-bottom: 3px solid transparent; }
nav a.active { color: #0f766e; border-bottom-color: #0f766e; font-weight: 600; }
.lang-switch { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.lang-btn { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; border-radius: 6px; padding: 5px 12px; font-size: 13px; font-family: inherit; cursor: pointer; }
.lang-btn.on { background: #0f766e; color: #fff; border-color: #0f766e; }
.lang-btn:hover { background: #e5e7eb; }
.lang-btn.on:hover { background: #115e59; }
main { max-width: 980px; margin: 24px auto; padding: 0 16px; }
.card { background: #fff; border-radius: 12px; padding: 22px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px; }
.direction { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 16px; font-weight: 600; color: #0f766e; margin-bottom: 16px; flex-wrap: wrap; }
.direction .arrow { font-size: 22px; }
textarea { width: 100%; min-height: 150px; border: 1px solid #d1d5db; border-radius: 10px; padding: 14px; font-size: 17px; font-family: inherit; resize: vertical; }
textarea[dir="ltr"] { direction: ltr; text-align: left; }
button, .btn { background: #0f766e; color: #fff; border: none; border-radius: 8px; padding: 11px 22px; font-size: 15px; font-family: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: #115e59; }
button.secondary, .btn.secondary { background: #e5e7eb; color: #374151; }
button.secondary:hover, .btn.secondary:hover { background: #d1d5db; }
button:disabled { opacity: .5; cursor: default; }
.result-box { border: 1px solid #d1d5db; border-radius: 10px; padding: 14px; min-height: 150px; font-size: 17px; white-space: pre-wrap; background: #fafafa; }
.result-box.streaming { border-color: #0f766e; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .cols { grid-template-columns: 1fr; } }
.col-label { font-size: 13px; color: #6b7280; margin-bottom: 6px; font-weight: 600; }
.badge { display: inline-block; font-size: 12.5px; border-radius: 20px; padding: 4px 12px; margin-inline-start: 8px; font-weight: 600; }
.badge.demo { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.badge.real { background: #d1fae5; color: #065f46; border: 1px solid #10b981; }
.chips { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; border-radius: 20px; padding: 3px 12px; font-size: 13px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; border-radius: 8px; padding: 10px 14px; margin-top: 12px; display: none; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; text-align: start; }
th { background: #f9fafb; font-weight: 600; color: #374151; }
input[type="text"], input[type="search"] { border: 1px solid #d1d5db; border-radius: 8px; padding: 9px 12px; font-size: 15px; font-family: inherit; }
.file-drop { border: 2px dashed #9ca3af; border-radius: 12px; padding: 34px; text-align: center; color: #6b7280; cursor: pointer; }
.file-drop:hover { border-color: #0f766e; color: #0f766e; }
.note { font-size: 13px; color: #6b7280; margin-top: 8px; }
.empty { text-align: center; color: #9ca3af; padding: 30px; }
.icon-btn { background: transparent; border: none; color: inherit; cursor: pointer; padding: 2px; opacity: .7; }
.icon-btn:hover { opacity: 1; background: transparent; }
/* ---------- المحادثة ---------- */
.chat-wrap { max-width: 760px; margin: 0 auto; }
.msgs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 16px; line-height: 1.65; cursor: pointer; word-break: break-word; }
.msg.own { background: #0f766e; color: #fff; align-self: flex-end; }
.msg.other { background: #fff; border: 1px solid #e5e7eb; align-self: flex-start; }
.msg .who { font-size: 11.5px; font-weight: 700; opacity: .75; margin-bottom: 2px; }
.msg .meta { font-size: 11.5px; opacity: .65; margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.msg .orig { display: none; margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(127,127,127,.45); font-size: 14px; }
.msg.show-orig .orig { display: block; }
.composer { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 0; background: #f0f2f5; padding: 12px 0 4px; }
.composer textarea { min-height: 52px; flex: 1; }
.mic { background: #fff; border: 2px solid #0f766e; color: #0f766e; border-radius: 50%; width: 52px; height: 52px; padding: 10px; flex-shrink: 0; }
.mic.listening { background: #dc2626; border-color: #dc2626; color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.listen-state { font-size: 13.5px; color: #dc2626; font-weight: 600; min-height: 20px; margin-top: 4px; }
.mic-err { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: 13.5px; display: none; }
.via-badge { font-size: 11px; background: rgba(0,0,0,.18); border-radius: 10px; padding: 1px 8px; }
.msg.other .via-badge { background: #f3f4f6; }
.share-link { direction: ltr; text-align: left; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; word-break: break-all; margin-top: 6px; }
.demo-banner { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; border-radius: 8px; padding: 8px 14px; font-size: 13.5px; margin-bottom: 14px; font-weight: 600; }
.hint { font-size: 12.5px; color: #6b7280; text-align: center; margin-bottom: 12px; }
.autospeak { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: #374151; }
.speaking { animation: pulse 1s infinite; color: #0f766e !important; opacity: 1 !important; }
.secondary.listening { background: #dc2626; border-color: #dc2626; color: #fff; }
