/* ============================================================
   خواب‌سنج — سیستم طراحی
   پالت: آبی نیمه‌شب + بنفش کهکشانی روی زمینه تیره، برای حس آرامش،
   اعتماد و کیفیت. تایپوگرافی: Vazirmatn.
   ============================================================ */

:root{
  --bg-0:#070914;
  --bg-1:#0c1024;
  --bg-2:#12173a;
  --surface: rgba(255,255,255,0.045);
  --surface-strong: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.16);

  --ink-0:#f5f6ff;
  --ink-1:#c7cbe8;
  --ink-2:#8d93bf;
  --ink-3:#5d6390;

  --primary:#7c8cff;
  --primary-dark:#5765e0;
  --accent:#a78bfa;
  --accent-2:#38d6c8;

  --success:#3fd992;
  --warning:#f5b942;
  --danger:#ff6b7a;

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --shadow-soft: 0 20px 60px -20px rgba(10,12,40,0.6);
  --shadow-glow: 0 0 0 1px rgba(124,140,255,0.18), 0 20px 60px -15px rgba(90,100,255,0.35);

  --ff: 'Vazirmatn', 'Tahoma', sans-serif;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--ff);
  background: var(--bg-0);
  color: var(--ink-0);
  min-height:100vh;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}

/* ---------------------------------- پس‌زمینه تزیینی ---------------------------------- */
.bg-decor{ position:fixed; inset:0; z-index:0; overflow:hidden; pointer-events:none; }
.bg-decor::after{
  content:""; position:absolute; inset:0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(87,101,224,0.28), transparent 60%),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(167,139,250,0.14), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
}
.orb{ position:absolute; border-radius:50%; filter: blur(70px); opacity:.35; }
.orb-1{ width:420px; height:420px; background: var(--primary); top:-140px; right:-100px; animation: float1 16s ease-in-out infinite; }
.orb-2{ width:360px; height:360px; background: var(--accent); bottom:-120px; left:-120px; animation: float2 20s ease-in-out infinite; }
.orb-3{ width:260px; height:260px; background: var(--accent-2); top:40%; left:50%; opacity:.14; animation: float1 24s ease-in-out infinite reverse; }
@keyframes float1{ 0%,100%{ transform: translate(0,0);} 50%{ transform: translate(30px,40px);} }
@keyframes float2{ 0%,100%{ transform: translate(0,0);} 50%{ transform: translate(-25px,-35px);} }

.stars{
  position:absolute; inset:0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 70% 20%, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 85% 60%, rgba(255,255,255,.3), transparent),
    radial-gradient(1.5px 1.5px at 10% 85%, rgba(255,255,255,.3), transparent),
    radial-gradient(1px 1px at 60% 90%, rgba(255,255,255,.25), transparent);
  background-size: 100% 100%;
  opacity:.6;
}

/* ---------------------------------- هدر ---------------------------------- */
.topbar{
  position: sticky; top:0; z-index:20;
  backdrop-filter: blur(14px);
  background: rgba(7,9,20,0.55);
  border-bottom: 1px solid var(--border);
}
.topbar-inner{
  max-width: 900px; margin:0 auto; padding: 14px 20px;
  display:flex; align-items:center; justify-content:space-between;
}
.brand{ display:flex; align-items:center; gap:8px; cursor:pointer; user-select:none; }
.brand-icon{
  font-size:20px; width:36px; height:36px; border-radius:11px;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: var(--shadow-glow);
}
.brand-name{ font-weight:700; font-size:17px; letter-spacing:.2px; }

/* ---------------------------------- دکمه‌ها ---------------------------------- */
.btn{
  font-family: var(--ff);
  border:none; cursor:pointer; border-radius: 999px;
  font-weight:600; font-size:15px;
  padding: 13px 26px;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
  white-space: nowrap;
}
.btn:active{ transform: scale(.97); }
.btn-primary{
  color:#0a0c1c;
  background: linear-gradient(135deg, #9aa6ff, var(--primary) 45%, var(--accent));
  box-shadow: 0 12px 30px -8px rgba(124,140,255,.55);
}
.btn-primary:hover{ box-shadow: 0 16px 38px -8px rgba(124,140,255,.7); transform: translateY(-1px); }
.btn-secondary{
  color: var(--ink-0);
  background: var(--surface-strong);
  border:1px solid var(--border-strong);
}
.btn-secondary:hover{ background: rgba(255,255,255,0.1); }
.btn-ghost{
  color: var(--ink-1);
  background: transparent;
  border:1px solid var(--border);
}
.btn-ghost:hover{ color: var(--ink-0); border-color: var(--border-strong); }
.btn-lg{ padding:16px 34px; font-size:16px; width:100%; }
.btn-sm{ padding:9px 16px; font-size:13px; }
.btn:disabled{ opacity:.45; cursor:not-allowed; transform:none; }

/* ---------------------------------- ساختار کلی ---------------------------------- */
.app-shell{
  position:relative; z-index:1;
  max-width: 720px; margin: 0 auto;
  padding: 36px 18px 80px;
  min-height: calc(100vh - 64px);
}
.view{ display:none; animation: viewIn .45s ease; }
.view.active{ display:block; }
@keyframes viewIn{
  from{ opacity:0; transform: translateY(14px); }
  to{ opacity:1; transform: translateY(0); }
}

.card{
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border:1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

/* ---------------------------------- صفحه فرود ---------------------------------- */
.hero{ text-align:center; padding: 46px 34px; }
.hero-badge{
  display:inline-block; font-size:12.5px; font-weight:600; color: var(--accent-2);
  background: rgba(56,214,200,0.12); border:1px solid rgba(56,214,200,0.3);
  padding: 7px 16px; border-radius:999px; margin-bottom:22px; letter-spacing:.2px;
}
.hero-title{ font-size: 32px; line-height:1.5; font-weight:800; margin: 0 0 18px; }
.text-gradient{
  background: linear-gradient(90deg, var(--primary), var(--accent) 60%, var(--accent-2));
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
.hero-desc{ color: var(--ink-1); font-size:15.5px; line-height:2; max-width:560px; margin:0 auto 26px; }
.hero-points{ display:flex; flex-direction:column; gap:10px; align-items:flex-start; max-width:360px; margin:0 auto 30px; }
.hero-point{ display:flex; align-items:center; gap:10px; font-size:14.5px; color: var(--ink-1); }
.point-ico{
  width:22px; height:22px; border-radius:50%; flex-shrink:0;
  background: rgba(63,217,146,0.15); color: var(--success);
  display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:800;
}
.hero-privacy{ margin-top:18px; font-size:12.5px; color: var(--ink-3); }

/* ---------------------------------- نوار پیشرفت ---------------------------------- */
.progress-wrap{ margin-bottom:20px; }
.progress-bar{ height:8px; border-radius:999px; background: var(--surface); overflow:hidden; border:1px solid var(--border); }
.progress-fill{
  height:100%; width:10%; border-radius:999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.progress-label{ margin-top:8px; font-size:13px; color: var(--ink-2); text-align:left; }

/* ---------------------------------- فرم چپتر ---------------------------------- */
.chapter-tag{
  display:inline-block; font-size:12.5px; font-weight:700; color: var(--primary);
  background: rgba(124,140,255,0.12); border:1px solid rgba(124,140,255,0.28);
  padding:5px 14px; border-radius:999px; margin-bottom:14px;
}
.chapter-title{ font-size:24px; font-weight:800; margin: 0 0 6px; }
.chapter-subtitle{ color: var(--ink-2); font-size:14px; margin:0 0 26px; line-height:1.9; }

.chapter-form{ display:flex; flex-direction:column; gap:20px; }
.field{ display:flex; flex-direction:column; gap:9px; }
.field label{ font-size:14px; font-weight:600; color: var(--ink-1); }
.field input[type=text], .field input[type=tel], .field input[type=number],
.field input[type=time], .field select, .field textarea{
  font-family: var(--ff);
  background: rgba(255,255,255,0.04);
  border:1px solid var(--border);
  border-radius: var(--radius-sm);
  padding:14px 16px; font-size:15px; color: var(--ink-0);
  outline:none; transition: border-color .18s ease, background .18s ease;
  width:100%;
}
.field textarea{ min-height:90px; resize:vertical; font-family:var(--ff); }
.field input::placeholder, .field textarea::placeholder{ color: var(--ink-3); }
.field input:focus, .field select:focus, .field textarea:focus{
  border-color: var(--primary); background: rgba(124,140,255,0.06);
}
.field select{ appearance:none; -webkit-appearance:none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9'><path d='M1 1l6 6 6-6' stroke='%238d93bf' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat:no-repeat; background-position: left 16px center;
}

/* دکمه‌های چند گزینه‌ای (select ساده و multiselect) */
.choice-row{ display:flex; flex-wrap:wrap; gap:9px; }
.choice-pill{
  padding:11px 18px; border-radius:999px; border:1px solid var(--border);
  background: rgba(255,255,255,0.03); color: var(--ink-1); cursor:pointer;
  font-size:14px; font-weight:600; transition: all .15s ease; user-select:none;
}
.choice-pill:hover{ border-color: var(--border-strong); color: var(--ink-0); }
.choice-pill.selected{
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent; color:#0a0c1c;
}

/* مقیاس ۰-۴ و ۰-۵ */
.scale-row{ display:flex; gap:8px; direction:ltr; justify-content:flex-end; }
.scale-dot{
  flex:1; text-align:center; padding:11px 4px; border-radius:12px;
  border:1px solid var(--border); background: rgba(255,255,255,0.03);
  color: var(--ink-2); cursor:pointer; font-size:13px; font-weight:700;
  transition: all .15s ease;
}
.scale-dot:hover{ border-color: var(--border-strong); }
.scale-dot.selected{
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color:#0a0c1c; border-color: transparent;
}
.scale-caption{ display:flex; justify-content:space-between; font-size:11px; color: var(--ink-3); margin-top:4px; direction:rtl; }

/* رنج اسلایدر */
input[type=range]{
  -webkit-appearance:none; width:100%; height:6px; border-radius:999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  outline:none;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none; width:22px; height:22px; border-radius:50%;
  background:#fff; border:3px solid var(--primary); cursor:pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
}
.range-value{ text-align:center; font-size:22px; font-weight:800; color: var(--primary); }

.form-actions{ margin-top:30px; }

/* ---------------------------------- آنالیز چپتر ---------------------------------- */
.analysis-header{ display:flex; align-items:center; gap:22px; margin-bottom:26px; flex-wrap:wrap; }
.score-ring-wrap{ position:relative; width:140px; height:140px; flex-shrink:0; }
.score-ring-wrap-lg{ margin:0 auto 18px; }
.score-ring{ width:140px; height:140px; transform: rotate(-90deg); }
.score-ring-bg{ fill:none; stroke: rgba(255,255,255,0.08); stroke-width:11; }
.score-ring-fill{
  fill:none; stroke: url(#none); stroke: var(--primary); stroke-width:11; stroke-linecap:round;
  stroke-dasharray: 377; stroke-dashoffset: 377;
  transition: stroke-dashoffset 1.1s cubic-bezier(.4,0,.2,1), stroke 1.1s ease;
}
.score-ring-value{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-size:34px; font-weight:800;
}
.analysis-heading{ flex:1; min-width:200px; }
.analysis-title{ font-size:22px; font-weight:800; margin: 6px 0 10px; }
.risk-pill{
  display:inline-block; padding:6px 14px; border-radius:999px; font-size:12.5px; font-weight:700;
  background: rgba(63,217,146,0.14); color: var(--success); border:1px solid rgba(63,217,146,0.3);
}
.risk-pill.risk-Medium{ background: rgba(245,185,66,0.14); color: var(--warning); border-color: rgba(245,185,66,0.3); }
.risk-pill.risk-High{ background: rgba(255,107,122,0.14); color: var(--danger); border-color: rgba(255,107,122,0.3); }

.metrics-grid{
  display:grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
  gap:12px; margin-bottom:26px;
}
.metric-box{
  background: rgba(255,255,255,0.035); border:1px solid var(--border);
  border-radius: var(--radius-sm); padding:14px 16px;
}
.metric-box .m-label{ font-size:12px; color: var(--ink-2); margin-bottom:6px; }
.metric-box .m-value{ font-size:16px; font-weight:700; color: var(--ink-0); }

.sw-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:14px; margin-bottom:22px; }
@media (max-width: 560px){ .sw-grid{ grid-template-columns: 1fr; } }
.sw-box{ border-radius: var(--radius-sm); padding:18px; border:1px solid var(--border); }
.sw-strength{ background: rgba(63,217,146,0.06); border-color: rgba(63,217,146,0.2); }
.sw-weakness{ background: rgba(255,107,122,0.06); border-color: rgba(255,107,122,0.2); }
.sw-box h3{ margin:0 0 10px; font-size:14.5px; }
.sw-box ul{ margin:0; padding-inline-start:18px; display:flex; flex-direction:column; gap:8px; }
.sw-box li{ font-size:13.5px; line-height:1.8; color: var(--ink-1); }

.feedback-box{
  background: rgba(124,140,255,0.06); border:1px solid rgba(124,140,255,0.2);
  border-radius: var(--radius-sm); padding:18px 20px; margin-bottom:14px;
}
.feedback-box h3{ margin:0 0 8px; font-size:14px; color: var(--primary); }
.feedback-box p{ margin:0; font-size:14.5px; line-height:2; color: var(--ink-1); }
.feedback-prediction{ background: rgba(167,139,250,0.06); border-color: rgba(167,139,250,0.2); }
.feedback-prediction h3{ color: var(--accent); }

/* ---------------------------------- نتیجه نهایی ---------------------------------- */
.final-card{ text-align:center; }
.final-badge{
  display:inline-block; font-size:12.5px; font-weight:700; color: var(--accent-2);
  background: rgba(56,214,200,0.12); border:1px solid rgba(56,214,200,0.3);
  padding:6px 16px; border-radius:999px; margin-bottom:18px;
}
.final-title{ font-size:24px; font-weight:800; margin:8px 0 14px; }
.final-card .sw-grid{ text-align:right; margin-top:26px; }

.code-box{
  margin-top:30px; padding:24px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(124,140,255,0.1), rgba(167,139,250,0.1));
  border:1px solid rgba(124,140,255,0.28);
}
.code-box-label{ font-size:13.5px; color: var(--ink-1); margin:0 0 14px; line-height:1.9; }
.code-display{
  font-size:30px; font-weight:800; letter-spacing:8px; direction:ltr;
  color: var(--ink-0); margin-bottom:16px; font-family: monospace, var(--ff);
}
.app-footer{ position:relative; z-index:1; text-align:center; padding:20px; color: var(--ink-3); font-size:12.5px; }

/* ---------------------------------- ورود با کد ---------------------------------- */
.lookup-form{ display:flex; gap:10px; margin-top:20px; flex-wrap:wrap; }
.code-input{
  flex:1; min-width:200px; font-family: monospace, var(--ff);
  background: rgba(255,255,255,0.04); border:1px solid var(--border);
  border-radius: var(--radius-sm); padding:14px 16px; font-size:18px; letter-spacing:4px;
  color: var(--ink-0); text-align:center; direction:ltr; outline:none;
}
.code-input:focus{ border-color: var(--primary); }
.lookup-error{ color: var(--danger); font-size:13.5px; margin-top:14px; min-height:18px; }

.lr-chapters{ margin-top:28px; display:flex; flex-direction:column; gap:10px; text-align:right; }
.lr-chapter-row{
  display:flex; justify-content:space-between; align-items:center;
  background: rgba(255,255,255,0.035); border:1px solid var(--border);
  border-radius: var(--radius-sm); padding:14px 18px;
}
.lr-chapter-row .lr-name{ font-size:14px; font-weight:600; color: var(--ink-1); }
.lr-chapter-row .lr-score{ font-size:15px; font-weight:800; color: var(--primary); }

/* ---------------------------------- توست ---------------------------------- */
.toast{
  position:fixed; bottom:26px; left:50%; transform: translateX(-50%) translateY(20px);
  background: rgba(20,22,44,0.95); border:1px solid var(--border-strong);
  padding:13px 24px; border-radius:999px; font-size:14px; color: var(--ink-0);
  box-shadow: var(--shadow-soft); opacity:0; pointer-events:none;
  transition: all .3s ease; z-index:100;
}
.toast.show{ opacity:1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------- ریسپانسیو ---------------------------------- */
@media (max-width: 600px){
  .hero{ padding:34px 20px; }
  .hero-title{ font-size:26px; }
  .card{ padding:26px 20px; border-radius:22px; }
  .analysis-header{ flex-direction:column; text-align:center; }
  .analysis-heading{ text-align:center; }
}



.telegram-desc{
    margin:20px auto 30px;
    max-width:520px;
    color:var(--ink-1);
    line-height:2;
    font-size:15px;
}

.telegram-box{

    margin-top:28px;
    padding:28px;

    border-radius:22px;

    background:
        linear-gradient(
            135deg,
            rgba(0,136,204,.12),
            rgba(124,140,255,.08)
        );

    border:1px solid rgba(0,136,204,.25);

}

.telegram-icon{

    width:74px;
    height:74px;

    margin:0 auto 18px;

    border-radius:50%;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:34px;

    background:#0088cc22;
}

.telegram-box h3{

    margin-bottom:14px;
    font-size:21px;
    font-weight:700;

}

.telegram-box p{

    color:var(--ink-1);

    line-height:2;

    margin-bottom:24px;

}

.code-actions{

    display:flex;
    justify-content:center;
    gap:12px;

}


.time-row{
    display:flex;
    align-items:center;
    gap:10px;
}

.time-row select{
    background:#25283F;      /* یا #fff اگر تم روشن داری */
    color:#ffffff;           /* رنگ متن */
    border:1px solid #3b82f6;
    border-radius:12px;
    padding:12px;
    font-size:18px;
    appearance:none;
    -webkit-appearance:none;
    -moz-appearance:none;
}

.time-row select option{
    background:#25283F;
    color:#ffffff;
}

.time-separator{
    font-size:22px;
    font-weight:bold;
}
