/* ===== Creator.ai — مكونات التطبيق (فوق style.css و dashboard.css) ===== */
body { background: #f0f4f9; }
[dir="ltr"] body { letter-spacing: -0.005em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border-radius: .75rem; padding: .55rem .95rem; font-size: .85rem; font-weight: 600; border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-dark { background: #1f1f1f; color: #fff; }
.btn-dark:hover:not(:disabled) { background: #3c4043; }
.btn-lime { background: #4285f4; color: #1f1f1f; }
.btn-lime:hover:not(:disabled) { background: #d3e3fd; }
.btn-ghost { border-color: #dde3ea; background: #fff; color: #1f1f1f; }
.btn-ghost:hover:not(:disabled) { border-color: #1f1f1f; }
.btn-danger { background: #fe2c55; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c5221f; }
.btn-sm { padding: .35rem .65rem; font-size: .78rem; border-radius: .6rem; }
.icon-btn { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: .7rem; color: #5f6368; transition: background .15s, color .15s; }
.icon-btn:hover { background: #e9eef6; color: #1f1f1f; }
.link { color: #0842a0; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* Toggle switch: style.css مرسومة للـ RTL بس */
[dir="ltr"] .toggle::after { right: auto; left: 3px; }
[dir="ltr"] .toggle:checked::after { transform: translateX(18px); }

/* Fields */
select.field { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2349534a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left .8rem center; padding-inline-end: 2rem; }
[dir="ltr"] select.field { background-position: right .8rem center; }
.field-sm { padding: .45rem .7rem; font-size: .82rem; border-radius: .6rem; }
textarea.field { line-height: 1.7; }
.field:disabled { background: #f8fafd; color: #5f6368; }
.field-hint { font-size: .72rem; color: #5f6368; margin-top: .3rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; cursor: pointer; }
.check input { width: 1rem; height: 1rem; accent-color: #1f1f1f; }

/* Toast */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 20px); z-index: 200; display: flex; align-items: center; gap: .5rem; max-width: calc(100vw - 2rem);
  background: #1f1f1f; color: #fff; border-radius: 1rem; padding: .75rem 1.1rem; font-size: .85rem; box-shadow: 0 18px 40px -12px rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: all .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok svg { color: #4285f4; }
.toast.err { background: #3a0d16; }
.toast.err svg { color: #ff7a93; }
@media (max-width: 767px) { .toast { bottom: 5.5rem; } }

/* Modal */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 640px) { .modal-wrap { align-items: center; padding: 1.5rem; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(31, 31, 31, .55); backdrop-filter: blur(2px); animation: fadeIn .2s ease; }
.modal-card { position: relative; width: 100%; max-height: 92vh; display: flex; flex-direction: column; background: #f8fafd; border-radius: 1.5rem 1.5rem 0 0; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); animation: modalIn .3s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 640px) { .modal-card { border-radius: 1.5rem; } }
.modal-body { overflow-y: auto; flex: 1; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(40px); } }

/* Side panel (drawer) */
.drawer-wrap { position: fixed; inset: 0; z-index: 90; }
.drawer { position: absolute; inset-block: 0; inset-inline-end: 0; width: min(560px, 100vw); background: #f8fafd; box-shadow: 0 0 60px -10px rgba(0,0,0,.4); display: flex; flex-direction: column; animation: drawerIn .3s cubic-bezier(.2,.8,.2,1); }
@keyframes drawerIn { from { transform: translateX(-100%); } }
[dir="ltr"] .drawer { animation-name: drawerInLtr; }
@keyframes drawerInLtr { from { transform: translateX(100%); } }

/* Tabs */
.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid #dde3ea; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: .7rem .9rem; font-size: .88rem; color: #5f6368; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; }
.tab:hover { color: #1f1f1f; }
.tab.active { color: #1f1f1f; font-weight: 600; }
.tab.active::after { content: ''; position: absolute; inset-inline: .5rem; bottom: -1px; height: 2px; border-radius: 2px; background: #1f1f1f; }
.tab .count { font-family: "Geist Mono", monospace; font-size: .7rem; background: #e9eef6; border-radius: 999px; padding: 0 .4rem; }
.seg-group { display: inline-flex; background: #e9eef6; border-radius: .75rem; padding: .2rem; gap: .15rem; }
.seg-group button { padding: .35rem .75rem; border-radius: .6rem; font-size: .8rem; color: #5f6368; }
.seg-group button.active { background: #fff; color: #1f1f1f; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Dropdown menu */
.menu { position: absolute; z-index: 60; min-width: 220px; background: #fff; border: 1px solid #dde3ea; border-radius: 1rem; box-shadow: 0 20px 40px -12px rgba(0,0,0,.25); padding: .35rem; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: .65rem; font-size: .85rem; text-align: start; color: #1f1f1f; }
.menu button:hover, .menu a:hover { background: #e9eef6; }
.menu .sep { height: 1px; background: #dde3ea; margin: .3rem .2rem; }
.menu .menu-label { padding: .4rem .7rem .2rem; font-size: .7rem; font-weight: 600; color: #5f6368; text-transform: uppercase; letter-spacing: .04em; }

/* Sidebar */
.nav-group { margin-top: 1.1rem; }
.nav-group-label { padding: 0 .75rem .35rem; font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.35); }
.nav-item .soon { margin-inline-start: auto; font-size: .6rem; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 0 .4rem; color: rgba(255,255,255,.45); }
.ws-switch { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .6rem .7rem; border-radius: .9rem; background: rgba(255,255,255,.05); text-align: start; transition: background .15s; }
.ws-switch:hover { background: rgba(255,255,255,.1); }
#mobile-nav.open { transform: translateX(0); }

/* Cards / misc */
.tile { background: #fff; border: 1px solid #dde3ea; border-radius: 1.25rem; }
.section-title { font-size: 1.05rem; font-weight: 700; }
.muted { color: #5f6368; }
.badge-lock { display: inline-flex; align-items: center; gap: .25rem; font-size: .65rem; font-weight: 600; border-radius: 999px; padding: .1rem .45rem; background: #fff4d6; color: #7a5a00; }
.dl { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: .55rem 1rem; font-size: .88rem; }
.dl dt { color: #5f6368; }
.dl dd { min-width: 0; overflow-wrap: anywhere; }
.code { font-family: "Geist Mono", monospace; font-size: .78rem; background: #e9eef6; border-radius: .5rem; padding: .15rem .45rem; direction: ltr; unicode-bidi: isolate; }
.codeblock { font-family: "Geist Mono", monospace; font-size: .75rem; line-height: 1.6; background: #1f1f1f; color: #e8f5c8; border-radius: 1rem; padding: 1rem; overflow-x: auto; direction: ltr; text-align: left; white-space: pre; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.creator-row { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.creator-row .meta { min-width: 0; }
.creator-row .meta b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creator-row .meta > span { display: block; font-size: .75rem; color: #5f6368; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chk-card { position: relative; }
.chk-card input { position: absolute; opacity: 0; pointer-events: none; }
.chk-card span { display: flex; align-items: center; gap: .5rem; border: 1px solid #dde3ea; background: #fff; border-radius: .9rem; padding: .65rem .8rem; font-size: .85rem; cursor: pointer; transition: all .15s; }
.chk-card input:checked + span { border-color: #1f1f1f; background: #1f1f1f; color: #fff; }
.chk-card input:focus-visible + span { outline: 2px solid #4285f4; outline-offset: 2px; }
.stepper-dot { width: 1.6rem; height: 1.6rem; border-radius: 999px; display: grid; place-items: center; font-family: "Geist Mono", monospace; font-size: .72rem; border: 1px solid #c4c7c5; color: #5f6368; }
.stepper-dot.on { background: #0b57d0; border-color: #0b57d0; color: #fff; }
.lock-overlay { position: relative; }
.lock-overlay > .lock-msg { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(248, 250, 253,.75); backdrop-filter: blur(2px); border-radius: inherit; z-index: 2; }
.impersonate-bar { background: repeating-linear-gradient(45deg, #fe2c55 0 12px, #c5221f 12px 24px); color: #fff; }
.demo-bar { background: #1f1f1f; color: rgba(255,255,255,.7); }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: .3rem .4rem .6rem; font-size: .82rem; font-weight: 600; }
.mini-stat { display: flex; flex-direction: column; }
.mini-stat b { font-family: "Geist Mono", monospace; font-size: 1rem; }
.mini-stat span { font-size: .7rem; color: #5f6368; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, #f0f4f9 70%, transparent); padding-top: 1rem; }

/* Print / PDF export */
@media print {
  body.printing * { visibility: hidden !important; }
  body.printing .print-target, body.printing .print-target * { visibility: visible !important; }
  body.printing .print-target { position: absolute; inset: 0; width: 100%; padding: 0; }
  body.printing .no-print { display: none !important; }
  body { background: #fff !important; }
  .kpi, .panel, .tile { break-inside: avoid; box-shadow: none !important; }
  @page { margin: 14mm; }
}

/* ================= Gemini theme ================= */
:root {
  --g-grad: linear-gradient(90deg, #4796e3 0%, #9177c7 55%, #ca6673 100%);
  --g-grad-soft: linear-gradient(135deg, #e8f0fe 0%, #f3e8fd 55%, #fde8ec 100%);
  --g-primary: #0b57d0;
  --g-surface: #f8fafd;
  --g-side: #f0f4f9;
}
body { background: var(--g-surface); color: #1f1f1f; }
.g-text { background: var(--g-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.g-bg { background: var(--g-grad); color: #fff; }
.g-soft { background: var(--g-grad-soft); }
.g-border { border: 1px solid transparent; background: linear-gradient(#fff, #fff) padding-box, var(--g-grad) border-box; }
.ai-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--g-grad-soft); color: #5b3fa3; }
.ai-glow { box-shadow: 0 0 0 1px rgba(145,119,199,.25), 0 12px 32px -12px rgba(71,150,227,.45); }
.ai-spark { animation: aiPulse 2.4s ease-in-out infinite; }
@keyframes aiPulse { 50% { transform: scale(1.12) rotate(8deg); } }

/* Buttons: pill style */
.btn { border-radius: 999px; padding: .55rem 1.1rem; }
.btn-sm { border-radius: 999px; }
.btn-dark { background: var(--g-primary); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #0842a0; }
.btn-lime, .btn-ai { background: var(--g-grad); color: #fff; }
.btn-lime:hover:not(:disabled), .btn-ai:hover:not(:disabled) { filter: brightness(1.06); background: var(--g-grad); }
.btn-ghost { border-color: #c4c7c5; }
.btn-ghost:hover:not(:disabled) { border-color: #0b57d0; color: #0b57d0; background: #f8fafd; }
.btn-danger { background: #b3261e; }
.btn-danger:hover:not(:disabled) { background: #8c1d18; }
.link { color: #0b57d0; }
.field { border-color: #c4c7c5; border-radius: .9rem; }
.field:focus { border-color: #0b57d0; box-shadow: 0 0 0 3px rgba(11,87,208,.12); }
.chip { border-color: #c4c7c5; }
.chip.active { background: #d3e3fd; border-color: #d3e3fd; color: #041e49; }
.chip:hover { border-color: #0b57d0; }
.tab.active::after { background: #0b57d0; }
.tab.active { color: #0b57d0; }
.seg-group { background: #e9eef6; }

/* Sidebar: فاتح زي Gemini */
.side { background: var(--g-side); color: #1f1f1f; }
.nav-item { color: #444746; border-radius: 999px; padding: .6rem .9rem; font-weight: 500; }
.nav-item:hover { color: #1f1f1f; background: #e1e5ea; }
.nav-item.active { background: #d3e3fd; color: #041e49; font-weight: 600; }
.nav-item .count { background: #0b57d0; }
.ws-switch { background: #fff; border: 1px solid #dde3ea; }
.ws-switch:hover { background: #f8fafd; }
.bnav-item { color: #5f6368; }
.bnav-item.active { color: #0b57d0; }
.subnav { display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { padding: .4rem .9rem; border-radius: 999px; font-size: .82rem; color: #444746; white-space: nowrap; border: 1px solid #dde3ea; background: #fff; }
.subnav a:hover { border-color: #0b57d0; color: #0b57d0; }
.subnav a.active { background: #1f1f1f; border-color: #1f1f1f; color: #fff; font-weight: 600; }

/* Cards */
.panel, .kpi, .tile, .card, .camp { border-color: #dde3ea; border-radius: 1.25rem; }
.kpi.dark { background: linear-gradient(135deg, #1a73e8 0%, #7b5cc4 60%, #c0586a 100%); border-color: transparent; }
.kpi.dark .delta.up { color: #fff; background: rgba(255,255,255,.2); }
.delta.up { background: #e6f4ea; color: #137333; }
.delta.down { background: #fce8e6; color: #b3261e; }
::selection { background: #d3e3fd; color: #041e49; }

/* موبايل: عناصر الـ grid متكبرش أكتر من عرض الشاشة، والنصوص الطويلة تتلف */
.grid > *, .panel, .kpi, .tile, .card { min-width: 0; }
.panel, .kpi, .tile { overflow-wrap: anywhere; }
html, body { max-width: 100%; overflow-x: clip; }
