/* =========================================================
   سامانه ثبت اضافه‌کار — استایل مینیمال و سه‌بعدی (موبایل‌محور)
   ========================================================= */

:root {
  --bg:            #eef1f7;
  --bg-2:          #e3e8f2;
  --surface:       #f5f7fb;
  --surface-2:     #ffffff;
  --text:          #1f2740;
  --muted:         #7b849b;
  --line:          rgba(31, 39, 64, .08);

  --primary:       #4f6bff;
  --primary-dark:  #3a52d8;
  --success:       #16a97a;
  --success-dark:  #0f8560;
  --danger:        #f2545b;
  --danger-dark:   #cf3d44;

  --radius:        18px;
  --radius-sm:     13px;

  /* سایه‌های سه‌بعدی نرم */
  --sh-up:   8px 8px 18px rgba(31,39,64,.10), -8px -8px 18px rgba(255,255,255,.95);
  --sh-in:   inset 4px 4px 9px rgba(31,39,64,.09), inset -4px -4px 9px rgba(255,255,255,.95);
  --sh-btn:  0 6px 0 var(--btn-shadow, rgba(0,0,0,.18)), 0 10px 18px rgba(31,39,64,.18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 0 40px;
  font-family: "Vazirmatn", "IRANSans", Tahoma, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 100% -10%, #dfe7ff 0%, transparent 60%),
    radial-gradient(800px 400px at 0% 110%, #e8fff6 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0 0 10px; font-weight: 800; letter-spacing: -.2px; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1.02rem; }

p { margin: 0 0 10px; }

.muted { color: var(--muted); }
.small, small { font-size: .78rem; }

/* ---------- چیدمان ---------- */
.container {
  width: 100%;
  max-width: 480px;      /* اندازه گوشی موبایل */
  margin: 0 auto;
  padding: 16px;
}

.center-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 18px;
}

/* ---------- کارت‌ها ---------- */
.card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid rgba(255,255,255,.75);
  border-radius: var(--radius);
  box-shadow: var(--sh-up);
  padding: 18px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 480px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-2px); }

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.login-card { max-width: 400px; }

/* ---------- نوار بالا ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, var(--primary), #7a6bff);
  color: #fff;
  box-shadow: 0 8px 20px rgba(79,107,255,.32);
  border-radius: 0 0 22px 22px;
}
.topbar h1, .topbar strong { color: #fff; }
.topbar-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.topbar-sub, .topbar .muted { color: rgba(255,255,255,.85); font-size: .78rem; margin: 0; }
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title > div { min-width: 0; }
.topbar-title strong { display: block; font-size: 1rem; }

/* ---------- برند ---------- */
.brand { text-align: center; margin-bottom: 16px; }
.brand-badge {
  width: 62px; height: 62px;
  margin: 0 auto 10px;
  display: grid; place-items: center;
  font-size: 1.7rem;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(145deg, #6b83ff, #3a52d8);
  box-shadow: 0 10px 22px rgba(79,107,255,.4), inset 0 2px 6px rgba(255,255,255,.45);
}
.brand-badge.small {
  width: 38px; height: 38px; font-size: 1rem;
  border-radius: 13px; margin: 0;
  background: rgba(255,255,255,.22);
  box-shadow: inset 0 2px 5px rgba(255,255,255,.35);
}

/* ---------- فرم ---------- */
.field-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  margin: 12px 0 6px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: .93rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--sh-in);
  outline: none;
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: var(--sh-in), 0 0 0 4px rgba(79,107,255,.14);
}
select.input { appearance: none; background-image: none; }
textarea.input { min-height: 84px; }

.grid-form { display: grid; grid-template-columns: 1fr; gap: 4px; }
.grid-form .full { margin-top: 14px; }

.filters { display: grid; grid-template-columns: 1fr; gap: 4px; }
.filters-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.workday { margin-bottom: 6px; }

/* ردیف اپراتور: در موبایل کارت جداگانه */
.op-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #ffffff, #eef1f8);
  box-shadow: 4px 4px 12px rgba(31,39,64,.09), -4px -4px 12px rgba(255,255,255,.9);
  position: relative;
}
.op-row .btn-icon { justify-self: end; }

.row-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* انتخاب نقش */
.role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.role-switch label {
  display: block;
  text-align: center;
  padding: 11px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--sh-up);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s ease;
}
.role-switch input { display: none; }
.role-switch label:has(input:checked) {
  color: #fff;
  background: linear-gradient(145deg, #6b83ff, var(--primary-dark));
  box-shadow: 0 6px 16px rgba(79,107,255,.38), inset 0 2px 5px rgba(255,255,255,.35);
  transform: translateY(-1px);
}

/* ---------- دکمه‌ها ---------- */
.btn {
  --btn-shadow: rgba(31,39,64,.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  background: linear-gradient(145deg, #ffffff, #e7ebf5);
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: var(--sh-btn);
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, filter .2s ease;
}
.btn:hover  { filter: brightness(1.03); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--btn-shadow), 0 4px 8px rgba(31,39,64,.16); }

.btn-primary   { --btn-shadow: var(--primary-dark); color: #fff; background: linear-gradient(145deg, #6b83ff, var(--primary)); }
.btn-success   { --btn-shadow: var(--success-dark); color: #fff; background: linear-gradient(145deg, #29c894, var(--success)); }
.btn-danger    { --btn-shadow: var(--danger-dark);  color: #fff; background: linear-gradient(145deg, #ff7a80, var(--danger)); }
.btn-secondary { --btn-shadow: #b9c1d6; color: var(--text); background: linear-gradient(145deg, #ffffff, #dde3f0); }
.btn-light     { --btn-shadow: rgba(0,0,0,.22); color: var(--primary-dark); background: #fff; }

.btn-sm    { padding: 8px 12px; font-size: .8rem; border-radius: 11px; box-shadow: 0 4px 0 var(--btn-shadow), 0 6px 12px rgba(31,39,64,.16); }
.btn-icon  { width: 40px; height: 40px; padding: 0; border-radius: 13px; }
.btn-block { width: 100%; margin-top: 18px; }

/* ---------- برچسب‌ها و پیام‌ها ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: rgba(79,107,255,.12);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.7);
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 14px;
  box-shadow: var(--sh-up);
}
.alert-success { color: #0d6b4e; background: linear-gradient(145deg, #e6fbf2, #d3f5e7); }
.alert-error   { color: #9c2027; background: linear-gradient(145deg, #ffeced, #ffdcde); }

.warn { color: #9a6200; background: #fff6e3; padding: 10px 12px; border-radius: 12px; font-size: .85rem; }

.install-log { padding-inline-start: 18px; font-size: .88rem; }

.locked-card { text-align: center; }
.locked-icon { font-size: 3rem; margin-bottom: 6px; }

/* ---------- تب‌ها ---------- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--sh-in);
  overflow-x: auto;
}
.tab {
  flex: 1 0 auto;
  text-align: center;
  white-space: nowrap;
  padding: 10px 12px;
  font-size: .84rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  border-radius: 13px;
  transition: all .2s ease;
}
.tab.active {
  color: #fff;
  background: linear-gradient(145deg, #6b83ff, var(--primary-dark));
  box-shadow: 0 5px 12px rgba(79,107,255,.35), inset 0 2px 4px rgba(255,255,255,.3);
}

/* ---------- آمار ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 6px;
  text-align: center;
  font-size: .74rem;
  color: var(--muted);
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #ffffff, #e9edf7);
  box-shadow: var(--sh-up);
}
.stat-num { font-size: 1.35rem; font-weight: 800; color: var(--primary-dark); }

/* ---------- جدول‌ها (کارتی در موبایل) ---------- */
.table-wrap { width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table thead { display: none; }

.table tr {
  display: block;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #ffffff, #eef1f8);
  box-shadow: 4px 4px 12px rgba(31,39,64,.09), -4px -4px 12px rgba(255,255,255,.9);
}
.table td {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  word-break: break-word;
}
.table td:last-child { border-bottom: 0; }
.table td::before {
  content: attr(data-label);
  flex: 0 0 auto;
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
}
.table td .input { max-width: 60%; }

.cell-actions { display: flex; gap: 8px; }
.cell-actions form { display: inline; }

/* ---------- انیمیشن ---------- */
.fade-up { animation: fadeUp .45s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

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

/* ---------- نمایش در صفحه‌های بزرگ‌تر: همان قاب موبایل، وسط‌چین ---------- */
@media (min-width: 700px) {
  body { padding-bottom: 60px; }
  .container, .topbar-inner, .card { max-width: 480px; }
}
