/* ════════════════════════════════════════════════════════════════════
   ct-extras.css — استایل امکانات اضافی تقویم
   به انتهای cal-tab.css یا calendar.css اضافه کنید
   ════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════
   ۰) رفع مشکل padding چپ و راست تقویم
   ══════════════════════════════════════════ */
#tab-calendar {
  padding: 0 14px;
}

/* برای موبایل‌های کوچک */
@media (max-width: 360px) {
  #tab-calendar { padding: 0 10px; }
}

/* تبلت و بالاتر */
@media (min-width: 600px) {
  #tab-calendar { padding: 0 16px; }
}

/* ══════════════════════════════════════════
   ۱) ساعت شمسی دیجیتال
   ══════════════════════════════════════════ */
.ct-clock-widget {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  padding: 18px 20px 14px;
  border: 1px solid var(--ct-border, #e7e0cb);
  box-shadow: var(--ct-shadow-md, 0 4px 12px rgba(0,0,0,.08));
  transition: all 0.5s ease;
}

/* پس‌زمینه پویا بر اساس ساعت */
.ct-clock-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  transition: background 2s ease;
}

.ct-clock-widget[data-period="morning"] .ct-clock-bg {
  background: linear-gradient(135deg, #fed7aa 0%, #fef3c7 50%, #e0f2fe 100%);
}
.ct-clock-widget[data-period="afternoon"] .ct-clock-bg {
  background: linear-gradient(135deg, #bfdbfe 0%, #dbeafe 50%, #e0e7ff 100%);
}
.ct-clock-widget[data-period="evening"] .ct-clock-bg {
  background: linear-gradient(135deg, #fda4af 0%, #fed7aa 50%, #fde68a 100%);
}
.ct-clock-widget[data-period="night"] .ct-clock-bg {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #1e293b 100%);
}

[data-theme="dark"] .ct-clock-widget .ct-clock-bg {
  opacity: 0.5;
}

.ct-clock-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ct-clock-period-icon {
  font-size: 1.4rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.15));
}

.ct-clock-time-wrap {
  display: flex;
  align-items: baseline;
  gap: 1px;
}

.ct-clock-time {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  font-feature-settings: 'tnum' on;
  text-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.ct-clock-sec {
  font-size: 1.4rem;
  font-weight: 700;
  opacity: 0.5;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum' on;
}

/* رنگ متن بر اساس دوره */
.ct-clock-widget[data-period="morning"]  .ct-clock-time,
.ct-clock-widget[data-period="morning"]  .ct-clock-dow,
.ct-clock-widget[data-period="morning"]  .ct-clock-date-label { color: #92400e; }

.ct-clock-widget[data-period="afternoon"] .ct-clock-time,
.ct-clock-widget[data-period="afternoon"] .ct-clock-dow,
.ct-clock-widget[data-period="afternoon"] .ct-clock-date-label { color: #1e40af; }

.ct-clock-widget[data-period="evening"]  .ct-clock-time,
.ct-clock-widget[data-period="evening"]  .ct-clock-dow,
.ct-clock-widget[data-period="evening"]  .ct-clock-date-label { color: #9f1239; }

.ct-clock-widget[data-period="night"]    .ct-clock-time,
.ct-clock-widget[data-period="night"]    .ct-clock-dow,
.ct-clock-widget[data-period="night"]    .ct-clock-date-label { color: #e2e8f0; }

.ct-clock-dow {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  opacity: 0.75;
}

.ct-clock-date-label {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.6;
  letter-spacing: -0.01em;
}

/* نوار روز */
.ct-clock-day-bar-wrap {
  position: relative;
  z-index: 1;
  margin-top: 12px;
}

.ct-clock-day-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.55rem;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.45;
}

.ct-clock-widget[data-period="night"] .ct-clock-day-bar-label { color: #e2e8f0; }

.ct-clock-day-bar {
  height: 6px;
  background: rgba(0,0,0,.1);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.ct-clock-widget[data-period="night"] .ct-clock-day-bar { background: rgba(255,255,255,.12); }

.ct-clock-day-prog {
  height: 100%;
  border-radius: 999px;
  transition: width 1s linear;
}

.ct-clock-widget[data-period="morning"]  .ct-clock-day-prog { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.ct-clock-widget[data-period="afternoon"] .ct-clock-day-prog { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.ct-clock-widget[data-period="evening"]  .ct-clock-day-prog { background: linear-gradient(90deg, #e11d48, #f43f5e); }
.ct-clock-widget[data-period="night"]    .ct-clock-day-prog { background: linear-gradient(90deg, #6366f1, #818cf8); }

/* ══════════════════════════════════════════
   ۲) شمارش معکوس تعطیلی بعدی
   ══════════════════════════════════════════ */
.ct-holiday-countdown-wrap {
  border-radius: var(--ct-r-lg, 18px);
  overflow: hidden;
  border: 1px solid var(--ct-border, #e7e0cb);
  box-shadow: var(--ct-shadow-sm, 0 1px 3px rgba(0,0,0,.06));
  animation: ct-fade-up 0.35s ease both;
}

@keyframes ct-fade-up {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}

.ct-hc-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ct-surface, #fff);
  transition: background 0.3s ease;
}

.ct-hc-urgent {
  background: linear-gradient(135deg, rgba(184,84,26,.06) 0%, var(--ct-surface, #fff) 100%) !important;
  border-color: rgba(184,84,26,.25) !important;
}

.ct-hc-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.ct-hc-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.ct-hc-info {
  flex: 1;
  min-width: 0;
}

.ct-hc-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ct-text, #1a1f2e);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.ct-hc-title.ct-hc-loading {
  color: var(--ct-text-3, #8b94a8);
  animation: ct-blink 1.2s ease infinite;
}

@keyframes ct-blink { 0%,100%{opacity:.4} 50%{opacity:.9} }

.ct-hc-date {
  font-size: 0.66rem;
  color: var(--ct-text-3, #8b94a8);
  font-weight: 500;
  margin-top: 2px;
}

.ct-hc-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  background: var(--ct-primary-soft, rgba(13,110,98,.10));
  border: 1.5px solid rgba(13,110,98,.2);
  border-radius: 14px;
  padding: 8px 14px;
  min-width: 60px;
}

.ct-hc-urgent .ct-hc-countdown {
  background: rgba(184,84,26,.10);
  border-color: rgba(184,84,26,.25);
}

.ct-hc-num {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ct-primary, #0d6e62);
  letter-spacing: -0.03em;
  line-height: 1;
  font-feature-settings: 'tnum' on;
}

.ct-hc-urgent .ct-hc-num { color: var(--ct-today, #b8541a); }

.ct-hc-unit {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--ct-text-3, #8b94a8);
  letter-spacing: 0.03em;
}

.ct-hc-empty {
  padding: 14px;
  text-align: center;
  color: var(--ct-text-3, #8b94a8);
  font-size: 0.78rem;
}

/* ══════════════════════════════════════════
   ۳) یادداشت روزانه
   ══════════════════════════════════════════ */
.ct-notes-wrap {
  border-top: 1px dashed var(--ct-border, #e7e0cb);
  margin: 8px 14px 0;
  padding-top: 14px;
  padding-bottom: 16px;
  animation: ct-fade-up 0.25s ease both;
}

.ct-notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ct-notes-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ct-text, #1a1f2e);
  letter-spacing: -0.01em;
}

.ct-notes-hint {
  font-size: 0.6rem;
  color: var(--ct-text-3, #8b94a8);
  font-weight: 500;
}

.ct-notes-ta {
  width: 100%;
  border: 1.5px solid var(--ct-border, #e7e0cb);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--ct-font, 'Vazirmatn', system-ui, sans-serif);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ct-text, #1a1f2e);
  background: var(--ct-surface-2, #f7f3e9);
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.6;
  direction: rtl;
  box-sizing: border-box;
}

.ct-notes-ta:focus {
  border-color: var(--ct-primary, #0d6e62);
  box-shadow: 0 0 0 3px var(--ct-primary-soft, rgba(13,110,98,.10));
  background: var(--ct-surface, #fff);
}

.ct-notes-ta::placeholder {
  color: var(--ct-text-3, #8b94a8);
  font-weight: 400;
}

.ct-notes-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
}

.ct-notes-chars {
  font-size: 0.62rem;
  color: var(--ct-text-3, #8b94a8);
  font-weight: 500;
  transition: color 0.3s ease;
  font-feature-settings: 'tnum' on;
}

.ct-notes-clear {
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--ct-font, system-ui, sans-serif);
  color: var(--ct-text-3, #8b94a8);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.ct-notes-clear:hover {
  background: rgba(185,28,28,.07);
  color: #b91c1c;
}

/* ══════════════════════════════════════════
   تم تاریک
   ══════════════════════════════════════════ */
[data-theme="dark"] .ct-hc-inner {
  background: var(--ct-surface, #131826);
}

[data-theme="dark"] .ct-hc-countdown {
  background: rgba(45,212,191,.10);
  border-color: rgba(45,212,191,.2);
}

[data-theme="dark"] .ct-hc-num { color: var(--ct-primary, #2dd4bf); }

[data-theme="dark"] .ct-notes-ta {
  background: var(--ct-surface-2, #1a2032);
  color: var(--ct-text, #e8eaf0);
  border-color: var(--ct-border, #2a3245);
}

[data-theme="dark"] .ct-notes-ta:focus {
  background: var(--ct-surface-3, #232b40);
}

/* ══════════════════════════════════════════
   ریسپانسیو
   ══════════════════════════════════════════ */
@media (max-width: 360px) {
  .ct-clock-time    { font-size: 2.6rem; }
  .ct-clock-sec     { font-size: 1.1rem; }
  .ct-hc-inner      { padding: 11px 12px; }
  .ct-hc-num        { font-size: 1.2rem; }
}

@media (min-width: 600px) {
  .ct-clock-time    { font-size: 3.8rem; }
  .ct-clock-widget  { padding: 22px 24px 16px; }
}

/* ══════════════════════════════════════════
   motion-reduce
   ══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .ct-clock-day-prog,
  .ct-holiday-countdown-wrap,
  .ct-notes-wrap,
  .ct-clock-bg { animation: none !important; transition: none !important; }
}