/* ============================================
   PERSIAN CALENDAR - Modern Dark Theme
   All fonts: local only
   ============================================ */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ── Root Variables ── */
:root {
  --bg-base:        #0a0e1a;
  --bg-card:        rgba(255,255,255,0.05);
  --bg-card-hover:  rgba(255,255,255,0.09);
  --border-glass:   rgba(255,255,255,0.10);
  --accent-blue:    #4f8ef7;
  --accent-purple:  #a78bfa;
  --accent-pink:    #f472b6;
  --accent-cyan:    #22d3ee;
  --accent-green:   #34d399;
  --text-primary:   #f0f4ff;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --today-glow:     rgba(79,142,247,0.5);
  --selected-glow:  rgba(167,139,250,0.5);
  --holiday-color:  #f87171;
  --radius-card:    20px;
  --radius-cell:    12px;
  --blur-glass:     16px;
  --transition:     0.3s cubic-bezier(0.34,1.56,0.64,1);
  --font-main:      'Vazirmatn', Tahoma, sans-serif;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* ── Page Wrapper ── */
#cal-page {
  min-height: 100vh;
  background: var(--bg-base);
  font-family: var(--font-main);
  direction: rtl;
  color: var(--text-primary);
  position: relative;
  overflow-x: hidden;
  padding-bottom: 40px;
}

/* ── Animated Background Orbs ── */
.cal-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 12s ease-in-out infinite alternate;
}
.cal-orb-1 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(79,142,247,0.25) 0%, transparent 70%);
  top: -120px; right: -100px;
  animation-delay: 0s;
}
.cal-orb-2 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(167,139,250,0.20) 0%, transparent 70%);
  bottom: 10%; left: -80px;
  animation-delay: -4s;
}
.cal-orb-3 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(244,114,182,0.15) 0%, transparent 70%);
  top: 50%; right: 10%;
  animation-delay: -8s;
}

@keyframes orbFloat {
  0%   { transform: translateY(0) scale(1); }
  100% { transform: translateY(-40px) scale(1.1); }
}

/* ── Content Layer ── */
.cal-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Top Header ── */
.cal-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 8px;
}

.cal-back-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: 18px;
  transition: background 0.2s, transform 0.2s;
  backdrop-filter: blur(var(--blur-glass));
}
.cal-back-btn:hover {
  background: var(--bg-card-hover);
  transform: scale(1.08);
}
.cal-back-btn:active { transform: scale(0.94); }

.cal-header-title {
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cal-header-action {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
  backdrop-filter: blur(var(--blur-glass));
}
.cal-header-action:hover { background: var(--bg-card-hover); }

/* ── Hero Card (date display) ── */
.cal-hero-card {
  margin-top: 12px;
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cal-hero-date {
  flex: 1;
}
.cal-hero-shamsi {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cal-hero-weekday {
  font-size: 14px;
  color: var(--accent-purple);
  font-weight: 500;
  margin-top: 4px;
}
.cal-hero-gregorian {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cal-hero-badges {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.cal-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.cal-badge-hijri {
  background: rgba(167,139,250,0.15);
  border-color: rgba(167,139,250,0.3);
  color: var(--accent-purple);
}
.cal-badge-holiday {
  background: rgba(248,113,113,0.15);
  border-color: rgba(248,113,113,0.3);
  color: var(--holiday-color);
}
.cal-badge-season {
  background: rgba(52,211,153,0.15);
  border-color: rgba(52,211,153,0.3);
  color: var(--accent-green);
}

/* ── Month Navigation ── */
.cal-nav-card {
  margin-top: 12px;
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-nav-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  user-select: none;
}
.cal-nav-btn:hover {
  background: rgba(79,142,247,0.2);
  border-color: rgba(79,142,247,0.4);
  color: var(--accent-blue);
}
.cal-nav-btn:active { transform: scale(0.90); }

.cal-nav-month {
  text-align: center;
  flex: 1;
}
.cal-nav-month-name {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cal-nav-year {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Calendar Grid Card ── */
.cal-grid-card {
  margin-top: 12px;
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  padding: 16px 12px 20px;
}

/* Day-of-week header */
.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 8px;
}
.cal-dow-cell {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cal-dow-cell.is-weekend {
  color: var(--holiday-color);
}

/* Grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-cell);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  border: 1px solid transparent;
  user-select: none;
}
.cal-cell:active { transform: scale(0.88); }

.cal-cell-num {
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-primary);
}

.cal-cell-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent-blue);
  position: absolute;
  bottom: 5px;
}

/* States */
.cal-cell.is-empty {
  cursor: default;
  opacity: 0;
}

.cal-cell.is-other-month .cal-cell-num {
  color: var(--text-muted);
  opacity: 0.5;
}

.cal-cell.is-holiday .cal-cell-num {
  color: var(--holiday-color);
}

.cal-cell.is-today {
  background: rgba(79,142,247,0.2);
  border-color: rgba(79,142,247,0.5);
  box-shadow: 0 0 16px var(--today-glow);
}
.cal-cell.is-today .cal-cell-num {
  color: var(--accent-blue);
  font-weight: 700;
}

.cal-cell.is-selected {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  border-color: transparent;
  box-shadow: 0 0 20px var(--selected-glow);
}
.cal-cell.is-selected .cal-cell-num {
  color: #fff;
  font-weight: 700;
}
.cal-cell.is-selected .cal-cell-dot {
  background: rgba(255,255,255,0.8);
}

.cal-cell:not(.is-empty):not(.is-selected):hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass);
  transform: scale(1.08);
}

/* ── Quick Stats Row ── */
.cal-stats-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.cal-stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  transition: transform 0.2s;
}
.cal-stat-card:active { transform: scale(0.96); }

.cal-stat-icon {
  font-size: 20px;
  margin-bottom: 6px;
  display: block;
}
.cal-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}
.cal-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* ── Events Section ── */
.cal-events-section {
  margin-top: 12px;
}

.cal-events-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}
.cal-events-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.cal-events-date-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Pill Tabs */
.cal-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 4px;
}
.cal-tabs::-webkit-scrollbar { display: none; }

.cal-tab {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: 0.2s;
  white-space: nowrap;
  backdrop-filter: blur(var(--blur-glass));
}
.cal-tab.is-active {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,142,247,0.3);
}

/* Event Cards */
.cal-event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-event-item {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: transform 0.2s, background 0.2s;
}
.cal-event-item:active { transform: scale(0.98); }

.cal-event-stripe {
  width: 3px;
  min-height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-top: 2px;
}
.cal-event-stripe.type-holiday  { background: var(--holiday-color); }
.cal-event-stripe.type-national { background: var(--accent-blue); }
.cal-event-stripe.type-religious{ background: var(--accent-purple); }
.cal-event-stripe.type-personal { background: var(--accent-green); }
.cal-event-stripe.type-other    { background: var(--text-muted); }

.cal-event-body {
  flex: 1;
  min-width: 0;
}
.cal-event-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}
.cal-event-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.cal-event-badge {
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.cal-event-badge.type-holiday  {
  background: rgba(248,113,113,0.15);
  color: var(--holiday-color);
}
.cal-event-badge.type-national {
  background: rgba(79,142,247,0.15);
  color: var(--accent-blue);
}
.cal-event-badge.type-religious{
  background: rgba(167,139,250,0.15);
  color: var(--accent-purple);
}
.cal-event-badge.type-personal {
  background: rgba(52,211,153,0.15);
  color: var(--accent-green);
}

.cal-no-events {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px dashed var(--border-glass);
}
.cal-no-events-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ── Add Event FAB ── */
.cal-fab {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(79,142,247,0.4);
  transition: var(--transition);
}
.cal-fab:hover  { transform: translateX(-50%) scale(1.05); }
.cal-fab:active { transform: translateX(-50%) scale(0.96); }

/* ── Modal / Bottom Sheet ── */
.cal-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.cal-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.cal-modal {
  width: 100%;
  max-width: 480px;
  background: #111827;
  border: 1px solid var(--border-glass);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 40px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.cal-modal-overlay.is-open .cal-modal {
  transform: translateY(0);
}

.cal-modal-handle {
  width: 40px; height: 4px;
  border-radius: 2px;
  background: var(--border-glass);
  margin: 0 auto 20px;
}

.cal-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-align: center;
}

/* Form inside modal */
.cal-form-group {
  margin-bottom: 16px;
}
.cal-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cal-form-input,
.cal-form-textarea,
.cal-form-select {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  direction: rtl;
}
.cal-form-input:focus,
.cal-form-textarea:focus,
.cal-form-select:focus {
  border-color: var(--accent-blue);
}
.cal-form-textarea { resize: vertical; min-height: 80px; }
.cal-form-select option { background: #111827; color: var(--text-primary); }

.cal-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.cal-btn {
  flex: 1;
  padding: 13px;
  border-radius: 14px;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.cal-btn:active { transform: scale(0.96); }

.cal-btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  box-shadow: 0 4px 16px rgba(79,142,247,0.3);
}
.cal-btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
}

/* ── Loading Screen ── */
.cal-loading {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s, visibility 0.5s;
}
.cal-loading.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.cal-loading-spinner {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent-blue);
  border-right-color: var(--accent-purple);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.cal-loading-text {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cal-hero-card,
.cal-nav-card,
.cal-grid-card,
.cal-stats-row,
.cal-events-section {
  animation: fadeInUp 0.5s ease both;
}
.cal-hero-card    { animation-delay: 0.05s; }
.cal-nav-card     { animation-delay: 0.10s; }
.cal-grid-card    { animation-delay: 0.15s; }
.cal-stats-row    { animation-delay: 0.20s; }
.cal-events-section { animation-delay: 0.25s; }

/* cell pop-in */
.cal-cell {
  animation: cellPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes cellPop {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── RTL Utilities ── */
.ltr { direction: ltr; }

/* ── Responsive ── */
@media (max-width: 360px) {
  .cal-hero-shamsi { font-size: 26px; }
  .cal-cell-num    { font-size: 13px; }
  .cal-stats-row   { grid-template-columns: 1fr 1fr 1fr; }
  .cal-stat-value  { font-size: 15px; }
}

@media (min-width: 481px) {
  #cal-page { padding-top: 20px; }
  .cal-fab  { max-width: 200px; }
}


/* ── Skeleton Loading ── */
.cal-cell.is-skeleton {
  cursor: default;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
  animation: skeletonPulse 1.2s ease-in-out infinite alternate !important;
}
.cal-cell.is-skeleton .cal-cell-num {
  color: transparent;
}
@keyframes skeletonPulse {
  from { opacity: 0.3; }
  to   { opacity: 0.7; }
}

/* ── Event Dots (multiple colors) ── */
.cal-cell-dots {
  display: flex;
  gap: 2px;
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}
.cal-cell-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-official      { background: #f87171; }
.dot-islamic       { background: #a78bfa; }
.dot-ancient       { background: #fb923c; }
.dot-international { background: #4f8ef7; }
.dot-other         { background: #34d399; }

/* ── Holiday badge در event list ── */
.cal-event-holiday-dot {
  margin-left: 4px;
  font-size: 10px;
}
