/* יומן פגישות: משותף לשלושת דפי האתר. משתמש במשתני הצבע של האתר, ולכן מתאים גם למצב כהה ולערכות הצבעים */
.cal-overlay { position: fixed; inset: 0; z-index: 9500; display: none; align-items: center; justify-content: center; padding: 12px; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.cal-overlay.open { display: flex; animation: calFade .25s ease; }
@keyframes calFade { from { opacity: 0; } to { opacity: 1; } }
.cal-panel { position: relative; background: var(--container-bg); color: var(--text-color); border: 1px solid var(--border-color); border-radius: 18px; width: 100%; max-width: 1000px; height: min(94vh, 840px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.4); overflow: hidden; text-align: right; }
.cal-panel svg { fill: currentColor; flex-shrink: 0; }

/* כותרת וכלי ניווט */
.cal-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border-color); background: var(--card-bg); }
.cal-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; font-weight: 800; color: var(--header-color); }
.cal-title svg { width: 22px; height: 22px; }
.cal-ctl { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.cal-month { min-width: 150px; text-align: center; line-height: 1.2; }
.cal-month b { display: block; font-size: 16px; color: var(--header-color); }
.cal-month small { font-size: 11.5px; opacity: .7; }
.cal-btn, .cal-nav-btn, .cal-today-btn, .cal-x, .cal-seg button, .cal-add { font-family: inherit; cursor: pointer; }
.cal-nav-btn, .cal-x { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 50%; border: 1px solid var(--accent-gold); background: var(--container-bg); color: var(--header-color); transition: transform .15s, background .15s; }
.cal-nav-btn:hover, .cal-x:hover { background: var(--card-bg); transform: translateY(-1px); }
.cal-nav-btn svg, .cal-x svg { width: 20px; height: 20px; }
.cal-today-btn { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--accent-gold); background: var(--container-bg); color: var(--header-color); font-weight: 700; font-size: 13.5px; }
.cal-today-btn:hover { background: var(--card-bg); }
.cal-seg { display: inline-flex; border: 1px solid var(--accent-gold); border-radius: 999px; overflow: hidden; }
.cal-seg button { padding: 7px 14px; border: 0; background: var(--container-bg); color: var(--text-color); font-weight: 700; font-size: 13.5px; }
.cal-seg button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); }
.cal-add { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 12px; border: 1px solid var(--accent-gold); background: var(--btn-bg); color: var(--btn-text); font-weight: 800; font-size: 14px; box-shadow: 0 3px 8px rgba(0,0,0,.15); }
.cal-add svg { width: 18px; height: 18px; transition: transform .35s ease; }

.cal-panel button:focus-visible, .cal-day:focus-visible, .cal-panel a:focus-visible { outline: 3px solid var(--header-color); outline-offset: 2px; }

/* גוף: לוח חודשי + פגישות היום הנבחר */
.cal-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px 18px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cal-body[data-view="list"] { grid-template-columns: minmax(0, 1fr); max-width: 720px; width: 100%; margin: 0 auto; }
.cal-body[data-view="list"] .cal-grid-wrap, .cal-body[data-view="list"] .cal-day-panel { display: none; }
.cal-body:not([data-view="list"]) .cal-upcoming { display: none; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow span { text-align: center; font-size: 12.5px; font-weight: 700; opacity: .7; padding: 4px 0 6px; }
.cal-dow span:last-child { color: var(--header-color); opacity: 1; }
.cal-day { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 66px; padding: 5px 2px 4px; border-radius: 12px; border: 1px solid var(--border-color); background: var(--container-bg); color: var(--text-color); font-family: inherit; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s; }
.cal-day:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(0,0,0,.4); background: var(--card-bg); }
.cal-day.out { opacity: .42; }
.cal-day.shabbat { background: var(--card-bg); }
.cal-day.sel { border-color: var(--header-color); box-shadow: 0 0 0 2px var(--header-color) inset; background: var(--card-bg); }
.cd-n { min-width: 26px; height: 26px; line-height: 26px; border-radius: 999px; text-align: center; font-weight: 800; font-size: 15px; }
.cal-day.today .cd-n { background: var(--btn-bg); color: var(--btn-text); }
.cd-h { font-size: 10.5px; opacity: .62; line-height: 1; }
.cd-dots { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 3px; margin-top: auto; padding-top: 3px; min-height: 10px; }
.cd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--k); }
.cd-dot.done { opacity: .35; }
.cd-more { font-size: 10.5px; font-weight: 800; line-height: 8px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; font-size: 12.5px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--k); display: inline-block; }

/* פגישות היום הנבחר, ורשימת הקרובות */
.cal-day-panel, .cal-upcoming { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cal-dp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-dp-head b { display: block; color: var(--header-color); font-size: 16.5px; }
.cal-dp-head small { display: block; font-size: 12.5px; opacity: .72; }
.cal-dp-add { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--accent-gold); background: var(--container-bg); color: var(--header-color); font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.cal-dp-add svg { width: 16px; height: 16px; }
.cal-dp-add:hover { background: var(--card-bg); }
.cal-empty { text-align: center; padding: 22px 12px; border: 1px dashed var(--border-color); border-radius: 14px; opacity: .85; }
.cal-empty svg { width: 34px; height: 34px; opacity: .45; margin-bottom: 4px; }
.cal-empty .cal-dp-add { margin-top: 8px; }
.cal-err { color: #dc2626; font-weight: 700; text-align: center; padding: 14px; }
.cal-up-day { margin: 8px 0 -2px; font-weight: 800; color: var(--header-color); font-size: 14.5px; }
.cal-up-day small { font-weight: 400; opacity: .7; margin-inline-start: 6px; }

.cal-item { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border: 1px solid var(--border-color); border-inline-start: 5px solid var(--k); border-radius: 14px; background: var(--card-bg); }
.ci-time { font-weight: 800; font-size: 17px; color: var(--header-color); text-align: center; line-height: 1.2; padding-top: 1px; direction: ltr; }
.ci-time.none { font-size: 11.5px; font-weight: 700; opacity: .6; direction: rtl; }
.ci-main { min-width: 0; }
.ci-name { font-weight: 800; font-size: 15.5px; overflow-wrap: anywhere; }
.ci-kind { display: inline-block; margin-inline-start: 6px; padding: 1px 10px; border-radius: 999px; background: var(--k); color: #fff; font-size: 12px; font-weight: 700; vertical-align: 1px; }
.ci-phone { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 13.5px; direction: ltr; color: var(--text-color); }
.ci-phone svg { width: 14px; height: 14px; }
.ci-notes { margin-top: 3px; font-size: 13.5px; white-space: pre-wrap; opacity: .85; overflow-wrap: anywhere; }
.ci-state { display: inline-block; margin-inline-start: 6px; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(5,150,105,.14); color: #047857; }
.cal-item.cancelled .ci-state { background: rgba(220,38,38,.12); color: #b91c1c; }
.cal-item.done .ci-name, .cal-item.cancelled .ci-name { text-decoration: line-through; opacity: .62; }
.cal-item.done, .cal-item.cancelled { opacity: .82; }
.ci-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ci-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 34px; height: 34px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--accent-gold); background: var(--container-bg); color: var(--header-color); font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .15s, background .15s; }
.ci-btn svg { width: 17px; height: 17px; }
.ci-btn:hover { background: var(--card-bg); transform: translateY(-1px); }
.ci-btn.on { background: var(--btn-bg); color: var(--btn-text); }
.ci-btn.confirm { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.ci-btn:is(:hover, :focus-visible) .ic-tick { animation: calTick .45s ease; }
.ci-btn:is(:hover, :focus-visible) .ic-edit { animation: calWiggle .5s ease; }
.ci-btn:is(:hover, :focus-visible) .ic-chat { animation: calPop .45s ease; }
.ci-btn:is(:hover, :focus-visible) .ic-trash { animation: calShake .5s ease; }
@keyframes calTick { 0% { transform: scale(1); } 40% { transform: scale(1.35) rotate(-8deg); } 100% { transform: none; } }
@keyframes calWiggle { 0%, 100% { transform: none; } 30% { transform: rotate(-14deg); } 60% { transform: rotate(8deg); } }
@keyframes calPop { 0% { transform: none; } 40% { transform: translateY(-3px) scale(1.15); } 100% { transform: none; } }
@keyframes calShake { 0%, 100% { transform: none; } 25% { transform: rotate(-10deg); } 55% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }

/* טופס הוספה / עריכה */
.cal-form-wrap { position: absolute; inset: 0; z-index: 5; display: none; align-items: center; justify-content: center; padding: 12px; background: rgba(0,0,0,.4); }
.cal-form-wrap.open { display: flex; animation: calFade .2s ease; }
.cal-form { background: var(--container-bg); color: var(--text-color); border: 1px solid var(--border-color); border-radius: 16px; padding: 16px; width: 100%; max-width: 470px; max-height: 100%; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.cal-form h3 { margin: 0 0 12px; text-align: center; color: var(--header-color); font-size: 18px; }
.cf-row { display: block; margin-bottom: 11px; font-size: 13.5px; font-weight: 700; }
.cf-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cf-row.two > label { display: block; }
.cf-lbl { display: block; margin-bottom: 5px; }
.cf-hint { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; opacity: .72; min-height: 1.1em; }
.cal-form input, .cal-form textarea, .cal-form select { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--container-bg); color: var(--text-color); font-family: inherit; font-size: 15px; font-weight: 400; }
.cal-form textarea { resize: vertical; min-height: 56px; }
.cal-form input:focus, .cal-form textarea:focus, .cal-form select:focus { outline: 2px solid var(--header-color); outline-offset: 1px; }
.cf-kinds { display: flex; flex-wrap: wrap; gap: 7px; }
.cf-kind { padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--k); background: transparent; color: var(--k); font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; transition: background .15s, color .15s, transform .12s; }
.cf-kind:hover { transform: translateY(-1px); }
.cf-kind[aria-pressed="true"] { background: var(--k); color: #fff; }
.cf-msg { min-height: 1.3em; margin: 4px 0 6px; text-align: center; font-weight: 700; color: #dc2626; font-size: 13.5px; }
.cf-acts { display: flex; gap: 8px; }
.cf-acts button { flex: 1; padding: 11px; border-radius: 10px; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 15px; border: 1px solid var(--accent-gold); }
.cf-save { background: var(--btn-bg); color: var(--btn-text); }
.cf-save:disabled { opacity: .6; cursor: wait; }
.cf-cancel { background: transparent; color: var(--text-color); border-color: var(--border-color) !important; }

@media (max-width: 820px) {
  .cal-overlay { padding: 0; }
  .cal-panel { height: 100%; max-height: none; border-radius: 0; border: 0; }
  .cal-body { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .cal-ctl { margin-inline-start: 0; order: 3; width: 100%; justify-content: space-between; }
  .cal-head .cal-x { margin-inline-start: auto; }
  .cal-add span { display: none; }
  .cal-add { padding: 8px 11px; }
  .cal-day { min-height: 54px; }
  .cd-n { font-size: 14px; }
}
@media (max-width: 420px) { .cal-grid, .cal-dow { gap: 3px; } .cal-day { min-height: 50px; border-radius: 10px; } .cf-row.two { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .cal-overlay.open, .cal-form-wrap.open { animation: none; } .cal-add:is(:hover, :focus-visible) svg, .ci-btn svg, .cal-day { animation: none !important; transition: none; } }
@media print { .cal-overlay { display: none !important; } }

/* דריסת כללי button/input הגלובליים של האתר (width:100%, padding) בתוך היומן */
.cal-panel button { width: auto; box-sizing: border-box; }
.cal-panel .cal-nav-btn, .cal-panel .cal-x { width: 36px; height: 36px; padding: 0; }
.cal-panel .cal-seg button { padding: 7px 14px; border-radius: 0; border: 0; }
.cal-panel .cal-today-btn { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--accent-gold); background: var(--container-bg); color: var(--header-color); font-weight: 700; font-size: 13.5px; }
.cal-panel .cal-add { padding: 8px 15px; border-radius: 12px; }
.cal-panel .ci-btn { padding: 0 11px; height: 34px; min-width: 34px; border-radius: 999px; }
.cal-panel .cf-acts button { width: auto; flex: 1; padding: 11px; border-radius: 10px; }
.cal-panel .cf-kind button, .cal-panel #cfKinds button { width: auto; }
@media (max-width: 560px) { .cal-panel .cal-add { padding: 8px 11px; } .cal-head .cal-ctl { order: 5; width: 100%; margin: 0; justify-content: space-between; } }
@media (max-width: 560px) {
  .cal-head { gap: 10px; }
  .cal-head .cal-title { order: 1; flex: 1; min-width: 0; }
  .cal-head .cal-x { order: 2; margin-inline-start: 0; }
  .cal-head .cal-seg { order: 3; flex: 1; }
  .cal-head .cal-seg button { flex: 1; }
  .cal-head .cal-add { order: 4; }
  .cal-head .cal-ctl { order: 5; }
}

.cal-panel .cal-print { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--accent-gold); background: var(--container-bg); color: var(--header-color); font-weight: 700; font-size: 13.5px; }
.cal-print svg { width: 18px; height: 18px; }
.cal-print:hover { background: var(--card-bg); }
.cp-opt { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; margin: 4px 0; }
.cp-opt input { width: auto; margin: 0; }
#calPrintWrap { z-index: 3; }
#cpRange { display: none; }
#cpGo { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
#cpGo svg { width: 18px; height: 18px; }
@media (max-width: 560px) { .cal-head .cal-print { order: 4; } .cal-print span { display: none; } .cal-panel .cal-print { padding: 0; width: 36px; justify-content: center; } }
@media print { .cal-overlay { display: none !important; } }
@media (max-width: 560px) {
  .cal-head .cal-title { order: 1; font-size: 17px; white-space: nowrap; }
  .cal-head .cal-print { order: 2; }
  .cal-head .cal-add { order: 3; }
  .cal-head .cal-x { order: 4; }
  .cal-head .cal-seg { order: 6; flex: 1 1 100%; }
  .cal-head .cal-ctl { order: 7; }
}
