/* Modellashtirish sahifasi. Sayt shisha (glass) uslubida; chizma maydoni — 1 sm katakli yashil bichish gilamchasi. */
.mod {
  --m-paper: #fbfaf5; --m-paper-dim: #cfd9d3; --m-paper-ink: #23212f;
  --m-spread: #a68bff; --m-ghost: rgba(255, 255, 255, .45); --m-emph: #ffb547;
  --m-mat: #1f5a4a; --m-mat-line: rgba(255, 255, 255, .08); --m-mat-major: rgba(255, 255, 255, .2); --m-mat-text: rgba(255, 255, 255, .55);
  --m-accent: #a044ff; --m-ok: #00c9a7;
  --m-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.mod-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; margin-bottom: 18px; }
.mod-tab { flex: 1 1 180px; display: block; text-align: center; padding: 11px 14px; border-radius: 12px; color: var(--text-mute); text-decoration: none; font-weight: 600; }
.mod-tab small { display: block; font: 500 .72rem/1.3 var(--m-mono); opacity: .8; margin-top: 2px; }
.mod-tab:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.mod-tab[aria-current="page"] { background: var(--grad-primary); color: #fff; }
.mod-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.mod-panel { padding: 18px; display: grid; gap: 18px; min-width: 0; }
.mod-lbl { font: 600 .7rem/1 var(--m-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 9px; }
.mod select, .mod textarea { width: 100%; font: inherit; color: var(--text); background: rgba(0, 0, 0, .22); border: 1px solid var(--glass-border); border-radius: 10px; padding: 9px 11px; }
.mod select option { color: #1a1a2e; }
.mod textarea { resize: vertical; min-height: 64px; font-size: .93rem; }
.mod-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mod-chip { font: 500 .9rem/1 inherit; font-family: inherit; border: 1px solid var(--glass-border); background: rgba(255, 255, 255, .04); color: var(--text); border-radius: 999px; padding: 8px 12px; cursor: pointer; }
.mod-chip:hover { border-color: var(--m-accent); }
.mod-chip[aria-pressed="true"] { background: var(--m-accent); border-color: var(--m-accent); color: #fff; }
.mod :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mod-sliders { display: grid; gap: 12px; }
.mod-slider { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: .92rem; }
.mod-slider output { font: 600 .9rem var(--m-mono); font-variant-numeric: tabular-nums; }
.mod-slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--m-accent); }

/* (AI uslublari pastda — .mod-aisec) */
.mod-panel-izoh { margin: 0; font-size: .85rem; color: var(--text-dim); }

.mod-stage { display: grid; gap: 14px; min-width: 0; }
.mod-mat { position: relative; background: var(--m-mat); border-radius: var(--radius); overflow: hidden; box-shadow: var(--glass-shadow); }
.mod-mat svg { display: block; width: 100%; height: auto; max-height: 78vh; }
.mod-mat-bar { position: absolute; inset: 10px 12px auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; pointer-events: none; }
.mod-mat-bar span { font: 500 .75rem var(--m-mono); color: var(--m-mat-text); }
.mod-mat-bar button { pointer-events: auto; font: 600 .82rem inherit; font-family: inherit; color: var(--m-mat); background: var(--m-paper); border: 0; border-radius: 999px; padding: 7px 12px; cursor: pointer; }
.mod-legend { position: absolute; left: 12px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .74rem; color: var(--m-mat-text); pointer-events: none; }
.mod-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.mod-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mod-stat { padding: 11px 13px; min-width: 0; }
.mod-stat small { display: block; font: 600 .66rem/1.25 var(--m-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim); }
.mod-stat b { display: block; font: 600 1.08rem/1.3 var(--m-mono); font-variant-numeric: tabular-nums; margin-top: 4px; overflow-wrap: anywhere; }
.mod-stat em { font-style: normal; font-size: .8rem; color: var(--text-mute); }
.mod-stat .up { color: var(--m-ok); }
.mod-steps { padding: 16px 20px; }
.mod-steps h2 { font-size: 1.05rem; margin: 0 0 8px; }
.mod-steps ol { margin: 0; padding-left: 22px; display: grid; gap: 5px; color: var(--text-mute); max-width: 80ch; }
.mod-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.mod-src { font-size: .8rem; color: var(--text-dim); margin: 10px 0 0; }

@media (prefers-reduced-motion: reduce) { .mod * { transition: none !important; } }

/* ================= AI modelchi — o'ng tomondagi chat ================= */
.mod .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mod-chat { position: sticky; top: calc(var(--header-h) + 12px); height: calc(100vh - var(--header-h) - 24px); min-height: 460px; display: flex; flex-direction: column; min-width: 0;
  border-radius: var(--radius); overflow: hidden; isolation: isolate;
  background: linear-gradient(170deg, rgba(160, 68, 255, .2), rgba(20, 24, 60, .55) 40%); border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: var(--glass-shadow); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
/* Chetida aylanib yuruvchi nur — AI alohida ajralib tursin; javob kutilayotganda tezlashadi */
.mod-chat::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; z-index: 2; pointer-events: none;
  background: conic-gradient(from var(--m-nur, 0deg), transparent 0 62%, #a044ff 76%, #ff6a88 86%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: modNur 7s linear infinite; }
.mod-chat.band::before { animation-duration: 1.4s; }
@property --m-nur { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes modNur { to { --m-nur: 360deg; } }
.mod-chat-h { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.mod-chat-h b { display: block; font-size: 1rem; }
.mod-chat-h small { display: block; font-size: .78rem; color: var(--text-dim); }
.mod-ai-badge { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--grad-primary); box-shadow: 0 6px 20px rgba(160, 68, 255, .45); color: #fff; }
.mod-ai-badge svg { width: 20px; height: 20px; animation: modYulduz 2.6s ease-in-out infinite; }
@keyframes modYulduz { 50% { transform: rotate(18deg) scale(1.15); } }
.mod-chat-yop { display: none; margin-left: auto; background: none; border: 0; color: var(--text-mute); cursor: pointer; padding: 6px; }
.mod-chat-yop svg { width: 20px; height: 20px; }

.mod-chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.mod-xb { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: .9rem; line-height: 1.45; animation: modKir .35s cubic-bezier(.2, .8, .2, 1) backwards; overflow-wrap: anywhere; }
.mod-xb.ai { align-self: flex-start; background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .1); border-bottom-left-radius: 4px; }
.mod-xb.men { align-self: flex-end; background: var(--grad-primary); color: #fff; border-bottom-right-radius: 4px; }
.mod-xb.men .mod-xb-rasm { position: relative; margin: -3px -6px 6px; border-radius: 10px; overflow: hidden; }
.mod-xb.men .mod-xb-rasm img { display: block; width: 100%; max-height: 200px; object-fit: cover; }
.mod-xb .mod-tugmalar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mod-xb .mod-tugmalar button { font: 600 .82rem inherit; font-family: inherit; color: var(--text); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: 6px 11px; cursor: pointer;
  animation: modKir .35s backwards; animation-delay: calc(var(--i, 0) * 110ms + 150ms); }
.mod-xb .mod-tugmalar button:hover { border-color: #ff6a88; }
.mod-xb .mod-tugmalar button[aria-pressed="true"] { background: var(--grad-primary); border-color: transparent; color: #fff; }
.mod-xb.xato { border-color: rgba(255, 87, 115, .5); color: #ffc2cc; }
/* Retsept tafsilotlari — yopiq; AI qanday o'ylaganini ko'rmoqchi bo'lgan uchun */
.mod-xb details { margin-top: 8px; font-size: .8rem; color: var(--text-mute); }
.mod-xb summary { cursor: pointer; color: var(--text-dim); }
.mod-xb summary:hover { color: var(--text); }
.mod-amallar { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; counter-reset: amal; }
.mod-amallar li { counter-increment: amal; display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 4px; animation: modKir .35s backwards; animation-delay: calc(var(--i, 0) * 90ms); }
.mod-amallar li::before { content: counter(amal); font: 700 .7rem/1.6 var(--m-mono); color: #ff8fa6; }
.mod-amallar li.yoq { opacity: .55; }
.mod-amallar code { font: 700 .76rem var(--m-mono); color: #d8c8ff; }
/* Javob kutilmoqda: uchta nuqta va qisqa holat */
.mod-yoz { display: inline-flex; align-items: center; gap: 8px; color: var(--text-mute); font-size: .84rem; }
.mod-yoz i { display: inline-flex; gap: 3px; }
.mod-yoz i b { width: 6px; height: 6px; border-radius: 50%; background: #ff8fa6; animation: modNuqta 1s ease-in-out infinite; }
.mod-yoz i b:nth-child(2) { animation-delay: .15s; } .mod-yoz i b:nth-child(3) { animation-delay: .3s; }
@keyframes modNuqta { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
/* Rasm o'rganilmoqda — skaner chizig'i */
.mod-scan { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 45%, rgba(255, 106, 136, .65) 50%, transparent 55%) 0 0 / 100% 200%;
  animation: modSkan 1.4s ease-in-out infinite alternate; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); }
@keyframes modSkan { from { background-position: 0 100%; } to { background-position: 0 0; } }

.mod-chat-in { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .1); background: rgba(10, 12, 40, .35); }
.mod-chat-in.ustida { outline: 2px dashed #ff6a88; outline-offset: -4px; }
.mod-chat-rasm { position: relative; display: inline-block; margin: 0 0 8px; }
.mod-chat-rasm img { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .25); }
.mod-chat-rasm button { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #ff5773; color: #fff; cursor: pointer; font: 700 14px/1 inherit; }
.mod-chat-qator { display: flex; align-items: flex-end; gap: 6px; }
.mod-chat-qator textarea { flex: 1; min-height: 40px; max-height: 120px; resize: none; padding: 9px 11px; border-radius: 12px; font-size: .9rem; line-height: 1.35; }
.mod-chat-klip, .mod-chat-yubor { flex: none; position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .07); color: var(--text); }
.mod-chat-klip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mod-chat-klip svg { width: 18px; height: 18px; transform: rotate(180deg); }
.mod-chat-yubor { background: var(--grad-primary); border-color: transparent; color: #fff; }
.mod-chat-yubor svg { width: 18px; height: 18px; }
.mod-chat-yubor[disabled] { opacity: .5; cursor: progress; }
.mod-chat-och { display: none; }

/* Gilamchadagi belgi: chizma AI retseptidan */
.mod-ai-belgi { margin-left: 10px; font-style: normal; font-weight: 700; color: #fff; background: var(--grad-primary); padding: 3px 8px; border-radius: 999px; animation: modKir .5s backwards; }
@keyframes modKir { from { opacity: 0; transform: translateY(8px); } }

/* O'rta ekranlar: chat o'ngdan chiqadigan panel */
@media (max-width: 1280px) {
  .mod-grid { grid-template-columns: 290px minmax(0, 1fr); }
  .mod-chat { position: fixed; top: auto; bottom: 0; right: 0; z-index: 60; width: min(400px, 100vw); height: min(640px, calc(100vh - var(--header-h)));
    border-radius: var(--radius) 0 0 0; transform: translateX(105%); transition: transform .35s cubic-bezier(.2, .8, .2, 1); background: linear-gradient(170deg, rgba(70, 40, 130, .96), rgba(22, 26, 64, .97) 45%); }
  .mod-chat.ochiq { transform: none; }
  .mod-chat-yop { display: block; }
  .mod-chat-och { display: inline-flex; align-items: center; gap: 7px; position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 59;
    font: 800 1rem/1 inherit; font-family: inherit; color: #fff; border: 0; border-radius: 999px; padding: 14px 20px; background: var(--grad-primary); box-shadow: 0 10px 30px rgba(160, 68, 255, .55); cursor: pointer; animation: modPuls 2.2s ease-in-out infinite; }
  .mod-chat-och svg { width: 20px; height: 20px; }
  @keyframes modPuls { 50% { box-shadow: 0 10px 30px rgba(160, 68, 255, .55), 0 0 0 10px rgba(160, 68, 255, .18); } }
}
@media (max-width: 900px) {
  .mod-grid { grid-template-columns: 1fr; }
  .mod-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mod-chat { width: 100vw; height: min(80vh, 640px); border-radius: var(--radius) var(--radius) 0 0; transform: translateY(105%); }
}
@media (prefers-reduced-motion: reduce) {
  .mod-chat::before, .mod-ai-badge svg, .mod-yoz i b, .mod-scan, .mod-chat-och, .mod-xb, .mod-xb .mod-tugmalar button, .mod-amallar li, .mod-ai-belgi { animation: none !important; }
  .mod-chat { transition: none; }
}
/* display qoidalari hidden atributini bekor qilmasin */
.mod [hidden], .mod-chat-rasm[hidden], .mod-chat-och[hidden] { display: none !important; }

/* AI javobi ustidan xabar berish */
.mod-xb .mod-xabar { margin-top: 6px; font-size: .78rem; color: var(--text-dim); }
.mod-xb .mod-xabar-och { font: inherit; color: var(--text-dim); background: none; border: 0; padding: 2px 0; cursor: pointer; }
.mod-xb .mod-xabar-och:hover { color: #ff6a88; }
.mod-xb .mod-xabar .mod-tugmalar { margin-top: 4px; }
