/* TadawiCalendar — Custom Arabic RTL calendar */

/* ── Panel ── */
.tc-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.04);
  z-index: 9999;
  width: 100%;
  direction: rtl;
  font-family: 'Cairo', 'Plus Jakarta Sans', sans-serif;
  padding: 6px;
  box-sizing: border-box;
}
.tc-panel-flow {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  margin-top: 4px;
  z-index: auto;
}

/* ── Header ── */
.tc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0 6px;
  gap: 4px;
}

/* ── Weekday headers ── */
.tc-weekdays {
  display: none;
}
.tc-title {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  flex: 1;
  justify-content: center;
}
.tc-title:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.tc-title-month {
  font-weight: 800;
  font-size: 0.78rem;
  color: #0f172a;
}
.tc-title-year {
  font-weight: 600;
  font-size: 0.72rem;
  color: #64748b;
}

/* ── Nav buttons ── */
.tc-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.tc-nav-btn:hover {
  background: #f0fdfa;
  border-color: #b2ebf2;
  color: #28B8D6;
}
.tc-nav-btn:focus-visible {
  outline: 2px solid #28B8D6;
  outline-offset: 2px;
}

/* ── Weekday headers ── */
.tc-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 6px;
  margin-bottom: 4px;
}
.tc-weekday {
  text-align: center;
  font-size: 0.58rem;
  font-weight: 700;
  color: #94a3b8;
  padding: 2px 0;
  user-select: none;
}

/* ── Days grid ── */
.tc-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  padding: 2px 0;
}

/* ── Day cell ── */
.tc-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  font-family: 'Cairo', 'Plus Jakarta Sans', sans-serif;
  font-weight: 500;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.12s ease;
  box-sizing: border-box;
  position: relative;
}
.tc-day:hover:not(.tc-day-disabled):not(.tc-day-other):not(.tc-day-selected) {
  background: #f1f5f9;
  color: #0f172a;
}

/* Today */
.tc-day-today:not(.tc-day-selected) {
  border: 2px solid #28B8D6;
  color: #28B8D6;
  font-weight: 700;
}
.tc-day-today:not(.tc-day-selected):hover {
  background: rgba(40,184,214,0.06);
}

/* Selected */
.tc-day-selected {
  background: linear-gradient(135deg, #28B8D6 0%, #1a9fb5 100%) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(40,184,214,0.3);
}

/* Other month */
.tc-day-other {
  color: #d1d5db;
  opacity: 0.5;
  cursor: pointer;
}
.tc-day-other:hover {
  opacity: 0.8;
  background: #f1f5f9;
}

/* Disabled */
.tc-day-disabled {
  color: #e5e7eb;
  cursor: not-allowed;
  background: transparent !important;
}
.tc-day-disabled:hover {
  background: transparent !important;
}

/* Empty cell */
.tc-day-empty {
  visibility: hidden;
  pointer-events: none;
}

/* Focus */
.tc-day:focus-visible {
  outline: 2px solid #28B8D6;
  outline-offset: 1px;
}

/* ── Month picker ── */
.tc-month-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px 0;
}
.tc-month-item {
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-family: 'Cairo', 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.12s;
}
.tc-month-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.tc-month-active {
  background: #f0fdfa !important;
  border-color: #28B8D6 !important;
  color: #28B8D6 !important;
  font-weight: 700;
}

/* ── Year picker ── */
.tc-year-picker {
  padding: 8px 0;
}
.tc-year-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 8px;
}
.tc-year-range {
  font-weight: 700;
  font-size: 0.88rem;
  color: #0f172a;
}
.tc-year-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tc-year-item {
  padding: 10px 4px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-family: 'Cairo', 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.12s;
}
.tc-year-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.tc-year-active {
  background: #f0fdfa !important;
  border-color: #28B8D6 !important;
  color: #28B8D6 !important;
  font-weight: 700;
}

/* ── Bottom buttons ── */
.tc-today-btn,
.tc-clear-btn {
  display: inline-block;
  margin: 4px 2px 2px;
  padding: 4px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-family: 'Cairo', 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.12s;
}
.tc-today-btn:hover {
  background: #f0fdfa;
  border-color: #28B8D6;
  color: #28B8D6;
}
.tc-clear-btn:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #ef4444;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .tc-panel {
    width: calc(100vw - 32px);
    max-width: 340px;
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    margin-top: 0;
  }
}
