@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --accent-color: #059669;
  --accent-hover: #047857;
  --accent-light: #d1fae5;
  --shabbat-color: #3b82f6;
  --shabbat-bg: #dbeafe;
  --holiday-color: #dc2626;
  --holiday-bg: #fee2e2;
  --rosh-chodesh-color: #7c3aed;
  --rosh-chodesh-bg: #ede9fe;
  --today-highlight: #f59e0b;
  --today-highlight-bg: #fef3c7;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-hebrew: 'Heebo', 'David', 'Arial', sans-serif;
  --font-ui: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #475569;
  --accent-color: #10b981;
  --accent-hover: #059669;
  --accent-light: #064e3b;
  --shabbat-color: #60a5fa;
  --shabbat-bg: #1e3a5f;
  --holiday-color: #f87171;
  --holiday-bg: #7f1d1d;
  --rosh-chodesh-color: #a78bfa;
  --rosh-chodesh-bg: #4c1d95;
  --today-highlight: #fbbf24;
  --today-highlight-bg: #451a03;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.25);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.3);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

[dir="rtl"] body {
  direction: rtl;
}

[dir="rtl"] .day-header:first-child {
  color: var(--shabbat-color);
}

/* RTL Support - Hebrew Calendar */
[dir="rtl"] .header-content {
  flex-direction: row-reverse;
}

[dir="rtl"] .controls {
  flex-direction: row-reverse;
}

[dir="rtl"] .location-display {
  flex-direction: row-reverse;
}

[dir="rtl"] .top-section {
  flex-direction: row;
}

[dir="rtl"] .top-section > *:first-child {
  margin-left: auto;
}

[dir="rtl"] .custom-event-card .event-countdown {
  text-align: left;
}

[dir="ltr"] .custom-event-card .event-countdown {
  text-align: right;
}

[dir="rtl"] .digital-clock .day-status {
  text-align: center;
}

[dir="rtl"] .converter-select,
[dir="rtl"] .converter-input {
  text-align: right;
}

[dir="rtl"] .converter-result {
  text-align: center;
}

[dir="rtl"] .nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .site-title {
  align-items: flex-end;
}

[dir="rtl"] .region-toggle {
  flex-direction: row-reverse;
}

/* RTL Calendar Grid - Saturday should be on the left */
[dir="rtl"] .calendar-header {
  direction: rtl;
}

[dir="rtl"] .calendar-grid {
  direction: rtl;
}

[dir="rtl"] .calendar-cell {
  border-right: none;
  border-left: 1px solid var(--border-color);
}

[dir="rtl"] .calendar-cell:nth-child(7n) {
  border-left: none;
}

/* RTL Day headers - Saturday (last) should be first visually in Hebrew calendar */
[dir="rtl"] .day-header {
  text-align: center;
}

[dir="rtl"] .day-header:last-child {
  color: var(--shabbat-color);
}

/* Reverse cell order for RTL - Saturday first (left side) */
[dir="rtl"] .calendar-header {
  display: flex;
  flex-direction: row-reverse;
}

[dir="rtl"] .calendar-header .day-header {
  flex: 1;
}

[dir="rtl"] .calendar-grid {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row-reverse;
}

[dir="rtl"] .calendar-cell {
  flex: 0 0 calc(100% / 7);
  border-right: none;
  border-left: 1px solid var(--border-color);
}

[dir="rtl"] .calendar-cell:nth-child(7n+1) {
  border-left: none;
}

/* RTL Event indicator - should be on the left */
[dir="rtl"] .event-indicator {
  left: 4px;
  right: auto;
}

/* RTL Modal */
[dir="rtl"] .modal-close {
  left: 0.75rem;
  right: auto;
}

[dir="rtl"] .modal-actions {
  justify-content: flex-start;
}

[dir="rtl"] .event-item {
  border-left: none;
  border-right: 3px solid var(--border-color);
}

[dir="rtl"] .practice-item {
  border-left: none;
  border-right: 3px solid var(--border-color);
}

[dir="rtl"] .event-modal-content {
  text-align: right;
}

/* RTL Hebrew text alignment */
[dir="rtl"] .hebrew-date {
  text-align: right;
}

[dir="rtl"] .today-hebrew {
  text-align: right;
}

[dir="rtl"] .parasha-hebrew {
  text-align: right;
}

/* RTL Sidebar */
[dir="rtl"] .sidebar {
  text-align: right;
}

[dir="rtl"] .card-title {
  text-align: right;
}

/* RTL Cell events - align right */
[dir="rtl"] .cell-events {
  text-align: right;
}

/* RTL Main layout - sidebar on left in RTL */
@media (min-width: 1025px) {
  [dir="rtl"] .main {
    direction: rtl;
  }
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

button:hover {
  background: var(--accent-light);
  border-color: var(--accent-color);
}

.header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
}

.title-en {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.title-he {
  font-family: var(--font-hebrew);
  direction: rtl;
  display: none;
}

/* Calendar Wrapper */
.calendar-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  padding: 1.5rem;
}

/* Top Section - Full Width */
.top-section {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .top-section {
    flex-direction: column;
  }
}

/* Clock Container */
.clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

@media (max-width: 768px) {
  .clock-container {
    flex: 1;
    display: flex;
    justify-content: center;
  }
}

/* Analog Clock */
.analog-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.analog-clock .clock-wrapper {
  background: var(--bg-primary);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .analog-clock .clock-wrapper {
  background: var(--bg-card);
}

.analog-clock .clock-wrapper canvas {
  display: block;
  width: 180px;
  height: 180px;
  border-radius: 50%;
}

.analog-clock .digital-clock {
  margin-top: 0.75rem;
  text-align: center;
}

.analog-clock .digital-clock .time-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  direction: ltr;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.analog-clock .digital-clock .time {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Montserrat', 'Arial Black', 'Arial-BoldMT', 'Arial Bold', Arial, Helvetica, sans-serif;
  color: var(--text-primary);
  letter-spacing: 2px;
  display: block;
  font-variant-numeric: tabular-nums;
  min-width: 6.5rem;
  text-align: right;
}

.analog-clock .digital-clock .period {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

.analog-clock .digital-clock .day-status {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-top: 0.25rem;
  font-family: var(--font-hebrew);
  direction: rtl;
}

.analog-clock .digital-clock {
  text-align: center;
  width: 100%;
}

.analog-clock .digital-clock .time {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Montserrat', 'Arial Black', 'Arial-BoldMT', 'Arial Bold', Arial, Helvetica, sans-serif;
  color: var(--text-primary);
  letter-spacing: 2px;
  display: block;
}

.analog-clock .digital-clock .period {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.analog-clock .digital-clock .day-status {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-top: 0.25rem;
  font-family: var(--font-hebrew);
  direction: rtl;
}

/* Custom Event Card */
.custom-event-card {
  flex: 1;
  min-width: 280px;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-card);
}

.custom-event-card:empty {
  display: none;
}

.event-image-placeholder {
  width: 120px;
  height: 120px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  overflow: hidden;
}

.custom-event-card .event-image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

.custom-event-card .event-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.custom-event-card .event-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.custom-event-card .event-title:hover {
  color: var(--accent-color);
}

.custom-event-card .event-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.custom-event-card .event-countdown {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-color);
  font-family: var(--font-hebrew);
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.nav-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-color);
}

.current-month {
  font-size: 1.25rem;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
  font-family: var(--font-hebrew);
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.day-header {
  padding: 0.75rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.day-header:last-child {
  color: var(--shabbat-color);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-cell {
  min-height: 100px;
  padding: 0.5rem;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.calendar-cell:nth-child(7n) {
  border-right: none;
}

.calendar-cell:hover {
  background: var(--accent-light);
}

.calendar-cell.other-month {
  opacity: 0.4;
}

.calendar-cell.today {
  background: var(--today-highlight-bg);
}

.calendar-cell.today .day-number {
  background: var(--today-highlight);
  color: #000;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-cell.shabbat {
  background: var(--shabbat-bg);
}

.calendar-cell.shabbat .day-number {
  color: var(--shabbat-color);
  font-weight: 700;
}

.calendar-cell.holiday {
  background: var(--holiday-bg);
}

.calendar-cell.rosh-chodesh {
  background: var(--rosh-chodesh-bg);
}

.calendar-cell.major-event {
  border: 2px solid var(--accent-color);
}

.day-number {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.hebrew-date {
  font-family: var(--font-hebrew);
  font-size: 0.75rem;
  direction: rtl;
  color: var(--text-secondary);
  line-height: 1.3;
}

.hebrew-date .month {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.cell-events {
  margin-top: 0.25rem;
}

.cell-event {
  font-size: 0.625rem;
  padding: 0.125rem 0.25rem;
  border-radius: 2px;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-event.shabbat {
  background: var(--shabbat-color);
  color: white;
}

.cell-event.holiday {
  background: var(--holiday-color);
  color: white;
}

.cell-event.rosh-chodesh {
  background: var(--rosh-chodesh-color);
  color: white;
}

.cell-event.omer {
  background: #ff9800;
  color: white;
}

.event-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--holiday-color);
  border-radius: 50%;
}

.calendar-cell.major-event .event-indicator {
  background: var(--accent-color);
  width: 10px;
  height: 10px;
}

/* Today Button Full Width */
.today-btn-full {
  display: block;
  width: 100%;
  padding: 0.875rem 1.5rem;
  margin-top: 1rem;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.today-btn-full:hover {
  background: var(--accent-hover, #1b5e20);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

[data-theme="dark"] .today-btn-full:hover {
  background: var(--accent-color);
}

/* Date Converter Card */
.date-converter-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
}

.converter-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.converter-select,
.converter-input {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.converter-select:focus,
.converter-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.converter-btn {
  background: var(--accent-color);
  color: white;
  border: none;
}

.converter-btn:hover {
  background: var(--accent-hover, #1b5e20);
}

.converter-select.half {
  width: calc(50% - 0.25rem);
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 60px;
}

#hebrewInput {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#hebrewInput .converter-select,
#hebrewInput .converter-input {
  flex: 1;
}

.converter-result {
  padding: 0.75rem;
  background: var(--accent-light);
  border-radius: var(--radius);
  text-align: center;
  font-weight: 600;
  font-family: var(--font-hebrew);
  direction: rtl;
  min-height: 2.5rem;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.today-card, .week-parasha, .info-card, .date-converter-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.today-date {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.today-hebrew {
  font-family: var(--font-hebrew);
  font-size: 1.25rem;
  direction: rtl;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.today-holidays {
  margin-bottom: 1rem;
}

.today-holidays .holiday-item {
  display: inline-block;
  background: var(--holiday-bg);
  color: var(--holiday-color);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  margin: 0.125rem;
}

.today-times {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.parasha-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.parasha-hebrew {
  font-family: var(--font-hebrew);
  font-size: 1rem;
  direction: rtl;
  color: var(--accent-color);
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.control-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.control-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.control-btn.small {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
}

.control-btn.icon-btn {
  padding: 0.5rem;
  font-size: 1.25rem;
  min-width: 40px;
}

.location-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.location-label {
  color: var(--text-muted);
}

.location-name {
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.region-toggle {
  display: flex;
  gap: 0.25rem;
}

.region-btn {
  padding: 0.375rem 0.5rem !important;
  font-size: 0.7rem !important;
  min-width: 50px;
}

.region-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.main {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .content-wrapper {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: -1;
  }
}

.android-promo {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

[data-theme="light"] .android-promo {
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.promo-icon {
  flex-shrink: 0;
}

.promo-icon svg {
  width: 40px;
  height: 40px;
}

.promo-content {
  flex: 1;
  min-width: 0;
}

.promo-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
}

[data-theme="light"] .promo-title {
  color: var(--text-primary);
}

.promo-desc {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 0.125rem;
}

[data-theme="light"] .promo-desc {
  color: var(--text-secondary);
}

.promo-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: #3DDC84;
  color: #1a1a2e;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.promo-btn:hover {
  transform: scale(1.05);
}

.promo-btn svg {
  width: 16px;
  height: 16px;
}

.location-modal,
.event-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.location-modal.active,
.event-modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
}

.modal-content h3 {
  margin-bottom: 1rem;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-content input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.modal-content input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.location-results {
  max-height: 250px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.location-result {
  padding: 0.75rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.2s ease;
}

.location-result:hover {
  background: var(--bg-secondary);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.event-list {
  margin-top: 1rem;
}

.event-item {
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  background: var(--bg-secondary);
  border-left: 3px solid var(--border-color);
}

.event-item.majorholiday {
  border-left-color: var(--accent-color);
}

.event-item.minorholiday {
  border-left-color: var(--holiday-color);
}

.event-item.fast {
  border-left-color: #ff9800;
}

.event-item.memorial {
  border-left-color: #9c27b0;
}

.event-item.special {
  border-left-color: #2196f3;
}

.event-type {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.event-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.event-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.no-events {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.event-practices {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.practices-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 0.75rem;
}

.practice-time-group {
  margin-bottom: 0.75rem;
}

.practice-time-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.375rem;
}

.practice-item {
  padding: 0.5rem;
  background: var(--bg-primary);
  border-radius: var(--radius);
  margin-bottom: 0.375rem;
  border-left: 3px solid var(--border-color);
}

.practice-item.obligatory {
  border-left-color: var(--accent-color);
}

.practice-item.customary {
  border-left-color: var(--text-muted);
}

.practice-badge {
  display: inline-block;
  font-size: 0.6rem;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.practice-badge.obligatory {
  background: var(--accent-light);
  color: var(--accent-color);
}

.practice-badge.customary {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.practice-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.practice-instruction {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.practice-applies {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-style: italic;
}

.footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }
  .nav {
    justify-content: center;
  }
  .controls {
    justify-content: center;
  }
  .location-display {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .calendar-cell {
    min-height: 70px;
    padding: 0.25rem;
  }
  .day-number {
    font-size: 0.75rem;
  }
  .hebrew-date {
    font-size: 0.625rem;
  }
  .cell-event {
    font-size: 0.5rem;
  }
  .day-header {
    padding: 0.5rem;
    font-size: 0.75rem;
  }
  .android-promo {
    flex-wrap: wrap;
    text-align: center;
    justify-content: center;
  }
  .promo-content {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
  }
  .promo-btn {
    width: 100%;
    justify-content: center;
  }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Bell Icon & Badge */
#reminderBell {
  position: relative;
}

#reminderBell svg {
  transition: transform 0.2s;
}

#reminderBell:hover svg {
  transform: scale(1.1);
}

#reminderBell.has-reminders svg {
  color: var(--accent-color);
}

.bell-badge-container {
  position: absolute;
  top: -10px;
  right: -10px;
  display: flex;
  align-items: center;
  gap: 0;
}

[dir="rtl"] .bell-badge-container {
  right: auto;
  left: -10px;
}

[dir="ltr"] .bell-badge-container {
  right: -10px;
  left: auto;
}

/* Badge sizing */
.bell-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  min-width: 22px;
  height: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

/* Default (LTR) badge styling */
.bell-badge.total {
  background: var(--accent-color);
  color: white;
  border-radius: 10px 0 0 10px;
}

.bell-badge.upcoming {
  background: var(--today-highlight);
  color: #000;
  border-radius: 0;
  animation: badge-pulse 1.5s ease-in-out infinite;
}

.bell-badge.expired {
  background: var(--holiday-color);
  color: white;
  border-radius: 0 10px 10px 0;
}

/* RTL badge styling - reverse the order */
[dir="rtl"] .bell-badge.total {
  border-radius: 0 10px 10px 0;
}

[dir="rtl"] .bell-badge.upcoming {
  border-radius: 0;
}

[dir="rtl"] .bell-badge.expired {
  border-radius: 10px 0 0 10px;
}

.bell-badge:only-child {
  border-radius: 50%;
  min-width: 22px;
  padding: 3px;
}

.bell-badge:not(:first-child):not(:last-child) {
  border-radius: 0;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius);
  line-height: 1;
}

.modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Reminder Form */
.reminder-form {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.date-type-toggle {
  display: flex;
  gap: 8px;
}

.date-type-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.date-type-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.date-inputs {
  display: flex;
  gap: 8px;
}

.date-select {
  flex: 1;
}

.date-input {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-danger {
  background: var(--holiday-color);
  color: white;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* Reminder List */
.reminder-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reminder-item {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border-color);
}

.reminder-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.reminder-item-title {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.reminder-item-actions {
  display: flex;
  gap: 8px;
}

.reminder-item-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
}

.reminder-item-actions button:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.reminder-item-actions .delete-btn:hover {
  color: var(--holiday-color);
}

.reminder-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.reminder-item-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.reminder-item-description {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.reminder-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.reminder-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

[dir="rtl"] .toast-container {
  right: auto;
  left: 20px;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  border-right: 4px solid var(--accent-color);
  animation: toast-in 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

[dir="rtl"] .toast {
  border-right: none;
  border-left: 4px solid var(--accent-color);
}

.toast.warning {
  border-color: var(--today-highlight);
}

.toast.reminder {
  border-color: var(--shabbat-color);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
}

.toast-close:hover {
  color: var(--text-primary);
}

@keyframes toast-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

[dir="rtl"] @keyframes toast-in {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

[dir="rtl"] @keyframes toast-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

/* Confirm Dialog */
.confirm-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}

.confirm-dialog-overlay.active {
  display: flex;
}

.confirm-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
}

.confirm-dialog h3 {
  margin-bottom: 12px;
  font-size: 1.125rem;
}

.confirm-dialog p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.confirm-dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}