/* ============================================
   TefilaTime — styles.css
   Variables, base, composants partagés,
   Screen 1 (Horloge + Zmanim),
   Screen 2 (Téfilot),
   Screen 3 (Chiourim)
   ============================================ */

/* ===== VARIABLES ===== */
:root {
  --gold: #e8c84a;
  --gold2: #f5d96a;
  --white: #ffffff;
  --white80: rgba(255, 255, 255, 0.85);
  --blue-panel: rgba(30, 60, 140, 0.92);
  --blue-header: rgba(45, 80, 180, 0.97);
  --shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
  --text-shadow: 1px 1px 6px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.6);
}

/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  font-family: 'Cinzel', serif;
  background: #000;
}

/* ===== FOND PHOTO ===== */
.bg {
  position: fixed;
  inset: 0;
  background-image: url('img/backgroundTiferet.png');
  background-size: cover;
  background-position: center;
  filter: brightness(0.55);
  z-index: 0;
}

/* ===== SYSTÈME D'ÉCRANS ===== */
.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  opacity: 0;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.7s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ===== BARRE DE PROGRESSION ===== */
.progress-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 100;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #fff);
  width: 0%;
}

/* ===== INDICATEURS DE PAGE ===== */
.page-dots {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 100;
}

.pdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.3s;
}

.pdot.on {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  width: 24px;
  border-radius: 4px;
}

/* ===== TITRE D'ÉCRAN (partagé) ===== */
.screen-title {
  font-family: 'Cinzel', serif;
  font-size: 40px;
  font-weight: 700;
  color: var(--white);
  text-shadow: var(--text-shadow);
  text-align: center;
  letter-spacing: 3px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.screen-title em {
  color: var(--gold);
  font-style: normal;
}

/* ============================================
   SCREEN 1 — Horloge + Zmanim
   ============================================ */

.s1 {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: 100vh;
}

/* Colonne gauche 2/3 */
.s1-left {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 40px 50px;
  gap: 0;
}

.s1-date-greg {
  font-family: 'Cinzel', serif;
  font-size: 38px;
  font-weight: 600;
  color: var(--white);
  text-shadow: var(--text-shadow);
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.s1-date-heb {
  font-family: 'Heebo', sans-serif;
  font-size: 24px;
  font-weight: 300;
  color: var(--gold2);
  text-shadow: var(--text-shadow);
  text-align: center;
  margin-top: 6px;
  direction: rtl;
  letter-spacing: 1px;
}

.s1-clock {
  font-family: 'Cinzel', serif;
  font-size: 130px;
  font-weight: 900;
  color: var(--gold);
  text-align: center;
  line-height: 1;
  text-shadow:
    0 0 40px rgba(232, 200, 74, 0.5),
    var(--text-shadow);
  letter-spacing: 4px;
  margin-top: 14px;
  direction: ltr;
}

.s1-clock .colon {
  animation: blink 1s steps(1) infinite;
  display: inline-block;
  margin: 0 4px;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.15;
  }
}

.s1-key-times {
  text-align: center;
  margin-top: 10px;
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: var(--white80);
  text-shadow: var(--text-shadow);
  letter-spacing: 1px;
  direction: ltr;
}

.s1-key-times span {
  color: var(--gold);
  font-weight: 700;
}

.s1-sep {
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 20px auto;
  opacity: 0.6;
}

/* Bloc Paracha */
.s1-parasha {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.s1-parasha-name {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  text-shadow: var(--text-shadow);
  letter-spacing: 1px;
}

.s1-parasha-name em {
  color: var(--gold);
  font-style: normal;
  font-size: 32px;
}

.s1-shabbat-row {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  color: var(--white);
  text-shadow: var(--text-shadow);
  letter-spacing: 0.5px;
  direction: ltr;
}

.s1-shabbat-row span {
  color: var(--gold);
  font-weight: 700;
}

/* Colonne droite 1/3 — panneau Zmanim */
.s1-right {
  background: var(--blue-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 2px solid rgba(232, 200, 74, 0.3);
}

.zmanim-panel-header {
  background: var(--blue-header);
  padding: 16px 20px;
  text-align: center;
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
}

.zmanim-panel-header h2 {
  font-family: 'Heebo', sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
  direction: rtl;
  letter-spacing: 1px;
}

.zmanim-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 10px 0;
  overflow: hidden;
}

/* Lignes de zmanim */
.zman-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 22px;
  transition: all 0.4s;
  position: relative;
}

.zman-item.past {
  opacity: 0.28;
}

.zman-item.next {
  background: rgba(232, 200, 74, 0.15);
  border-top: 1px solid rgba(232, 200, 74, 0.4);
  border-bottom: 1px solid rgba(232, 200, 74, 0.4);
}

.zman-item.next::before {
  content: '▶';
  position: absolute;
  left: 8px;
  color: var(--gold);
  font-size: 10px;
  animation: blink-arrow 1s infinite;
}

@keyframes blink-arrow {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

.zman-label {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  color: var(--white80);
  letter-spacing: 0.5px;
  font-weight: 400;
}

.zman-item.next .zman-label {
  color: var(--white);
  font-weight: 700;
  font-size: 15px;
}

.zman-val {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
}

.zman-item.past .zman-val {
  color: rgba(255, 255, 255, 0.25);
}
.zman-item.next .zman-val {
  font-size: 22px;
}

.zman-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 16px;
}

/* ============================================
   SCREEN 2 — Horaires des Téfilot
   ============================================ */

.s2 {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 36px 48px 28px;
  gap: 22px;
}

.s2-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  flex: 1;
  overflow: hidden;
}

.tefila-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.tefila-block-title {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  text-shadow: var(--text-shadow);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(232, 200, 74, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tefila-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}

/* Ligne de téfila */
.t-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-radius: 6px;
  background: rgba(0, 0, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  transition: all 0.4s;
}

.t-row.done {
  opacity: 0.3;
  background: rgba(0, 0, 0, 0.3);
}

.t-row.current {
  background: rgba(30, 80, 200, 0.55);
  border-color: rgba(232, 200, 74, 0.6);
  box-shadow: 0 0 18px rgba(232, 200, 74, 0.2);
}

.t-row.next-up {
  background: rgba(0, 20, 80, 0.6);
  border-color: rgba(232, 200, 74, 0.25);
}

.t-name {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
  text-shadow: var(--shadow);
  letter-spacing: 0.5px;
}

.t-row.current .t-name {
  color: var(--gold);
}

.t-sub {
  font-family: 'Heebo', sans-serif;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.t-right {
  display: flex;
  align-items: center;
  gap: 12px;
  direction: ltr;
}

.t-time {
  font-family: 'Cinzel', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: var(--shadow);
}

.t-row.done .t-time {
  color: rgba(255, 255, 255, 0.2);
}

/* Badges statut */
.t-tag {
  font-family: 'Heebo', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  min-width: 64px;
  text-align: center;
}

.tag-now {
  background: rgba(26, 184, 200, 0.3);
  color: #7ef0ff;
  border: 1px solid rgba(26, 184, 200, 0.5);
  animation: pulse-t 1.5s infinite;
}

.tag-soon {
  background: rgba(232, 200, 74, 0.2);
  color: var(--gold);
  border: 1px solid rgba(232, 200, 74, 0.4);
}

.tag-done {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tag-blank {
  opacity: 0;
}

@keyframes pulse-t {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ============================================
   SCREEN 3 — Cours & Chiourim
   ============================================ */

.s3 {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 30px 48px 24px;
  gap: 16px;
}

.s3-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-shrink: 0;
}

.s3-week {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.5);
  text-shadow: var(--shadow);
  direction: ltr;
  letter-spacing: 1px;
}

/* Bloc prochain cours */
.s3-hero {
  background: rgba(30, 60, 140, 0.75);
  border: 1px solid rgba(232, 200, 74, 0.5);
  border-radius: 8px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 30px rgba(232, 200, 74, 0.15);
}

.hero-badge {
  background: var(--gold);
  color: #000;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 4px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}

.hero-info {
  flex: 1;
}

.hero-name {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: var(--shadow);
  line-height: 1.2;
}

.hero-meta {
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 5px;
  display: flex;
  gap: 16px;
  direction: ltr;
}

.hero-time-block {
  text-align: center;
  direction: ltr;
  flex-shrink: 0;
}

.hero-time {
  font-family: 'Cinzel', serif;
  font-size: 40px;
  font-weight: 700;
  color: var(--white);
  text-shadow: var(--shadow);
  line-height: 1;
}

.hero-day {
  font-family: 'Heebo', sans-serif;
  font-size: 12px;
  color: var(--gold2);
  margin-top: 2px;
  letter-spacing: 1px;
}

/* Liste des cours */
.s3-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
  overflow: hidden;
  justify-content: flex-start;
}

.course-row {
  display: flex;
  align-items: center;
  padding: 13px 20px;
  border-radius: 6px;
  background: rgba(0, 0, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

/* Barre colorée à gauche selon la matière */
.course-row::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 6px 0 0 6px;
}

.c-gold::after {
  background: var(--gold);
}
.c-teal::after {
  background: #2dd4e8;
}
.c-green::after {
  background: #4ade80;
}
.c-purple::after {
  background: #c084fc;
}
.c-red::after {
  background: #f87171;
}

.c-day {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  min-width: 90px;
  text-align: center;
  letter-spacing: 0.5px;
  direction: ltr;
  flex-shrink: 0;
}

.c-sep {
  width: 1px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.c-info {
  flex: 1;
}

.c-name {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  text-shadow: var(--shadow);
  line-height: 1.2;
}

.c-teacher {
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 3px;
  direction: ltr;
}

.c-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  direction: ltr;
  flex-shrink: 0;
}

.c-time {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: var(--shadow);
}

.c-location {
  font-family: 'Heebo', sans-serif;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* Onglets mobiles — cachés par défaut, visibles uniquement sur mobile */
.mobile-tabs {
  display: none;
}

/* ============================================
   RESPONSIVE — Tablette & Mobile
   ============================================ */

/* ===== TABLETTE (max 1024px) ===== */
@media (max-width: 1024px) {
  /* Écran 1 */
  .s1 {
    grid-template-columns: 1fr 300px;
  }
  .s1-clock {
    font-size: 100px;
  }
  .s1-date-greg {
    font-size: 28px;
  }
  .s1-parasha-name {
    font-size: 22px;
  }
  .s1-parasha-name em {
    font-size: 26px;
  }
  .s1-shabbat-row {
    font-size: 16px;
  }
  .zman-label {
    font-size: 12px;
  }
  .zman-val {
    font-size: 15px;
  }
  .zman-item.next .zman-val {
    font-size: 18px;
  }

  /* Écran 2 */
  .s2 {
    padding: 24px 28px 20px;
    gap: 14px;
  }
  .t-name {
    font-size: 15px;
  }
  .t-time {
    font-size: 20px;
  }
  .t-row {
    padding: 10px 14px;
  }
  .tefila-block-title {
    font-size: 17px;
  }

  /* Écran 3 */
  .s3 {
    padding: 22px 28px 18px;
    gap: 12px;
  }
  .hero-name {
    font-size: 18px;
  }
  .hero-time {
    font-size: 32px;
  }
  .c-name {
    font-size: 14px;
  }
  .c-time {
    font-size: 18px;
  }
  .c-day {
    min-width: 70px;
    font-size: 12px;
  }
  .screen-title {
    font-size: 30px;
  }
}

/* ===== MOBILE (max 600px) — iOS Safari compatible ===== */
@media (max-width: 600px) {
  /* Réinitialiser le overflow bloquant */
  html {
    height: 100%;
    overflow: hidden;
  }

  body {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* Le fond reste fixe */
  .bg {
    position: fixed;
    z-index: 0;
  }

  /* Cacher progress bar et dots */
  .progress-bar,
  .page-dots {
    display: none !important;
  }

  /* Zone de contenu scrollable au-dessus des onglets */
  .screens-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
  }

  /* Chaque écran prend toute la hauteur disponible */
  .screen {
    position: relative;
    min-height: 100%;
    display: none !important;
  }

  .screen.active {
    display: flex !important;
    flex-direction: column;
    animation: none;
    opacity: 1;
  }

  /* ===== BARRE D'ONGLETS ===== */
  .mobile-tabs {
    display: flex !important;
    flex-shrink: 0;
    height: 60px;
    background: rgba(10, 15, 40, 0.98);
    border-top: 1px solid rgba(232, 200, 74, 0.4);
    z-index: 999;
    /* Safe area iPhone X+ */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.35);
    font-family: 'Heebo', sans-serif;
    font-size: 10px;
    letter-spacing: 0.5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-tab.active {
    color: #e8c84a;
  }
  .mobile-tab-icon {
    font-size: 22px;
    line-height: 1;
  }

  /* ===== ÉCRAN 1 — Zmanim ===== */
  .s1 {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100%;
  }

  .s1-left {
    padding: 16px 16px 0;
  }
  .s1-date-greg {
    font-size: 14px;
    letter-spacing: 0;
  }
  .s1-date-heb {
    font-size: 14px;
    margin-top: 4px;
  }
  .s1-clock {
    font-size: 70px;
    margin-top: 8px;
    letter-spacing: 2px;
  }
  .s1-key-times {
    font-size: 12px;
  }
  .s1-sep {
    margin: 10px auto;
  }
  .s1-parasha-name {
    font-size: 15px;
  }
  .s1-parasha-name em {
    font-size: 17px;
  }
  .s1-shabbat-row {
    font-size: 13px;
  }

  .s1-right {
    border-left: none;
    border-top: 2px solid rgba(232, 200, 74, 0.3);
  }

  .zmanim-panel-header h2 {
    font-size: 17px;
  }
  .zman-item {
    padding: 7px 14px;
  }
  .zman-label {
    font-size: 11px;
  }
  .zman-val {
    font-size: 14px;
  }
  .zman-item.next .zman-val {
    font-size: 16px;
  }

  /* ===== ÉCRAN 2 — Téfilot ===== */
  .s2 {
    height: auto;
    padding: 14px 12px;
    gap: 12px;
  }

  .s2-tables {
    grid-template-columns: 1fr;
    gap: 12px;
    flex: unset;
    overflow: visible;
  }

  .screen-title {
    font-size: 20px;
    letter-spacing: 1px;
  }
  .tefila-block-title {
    font-size: 14px;
  }
  .tefila-rows {
    overflow: visible;
    gap: 6px;
  }
  .t-row {
    padding: 10px 12px;
  }
  .t-name {
    font-size: 14px;
  }
  .t-sub {
    font-size: 11px;
  }
  .t-time {
    font-size: 18px;
  }
  .t-tag {
    font-size: 10px;
    padding: 3px 7px;
    min-width: 50px;
  }

  /* ===== ÉCRAN 3 — Chiourim ===== */
  .s3 {
    height: auto;
    padding: 14px 12px;
    gap: 10px;
  }

  .s3-header {
    flex-direction: column;
    gap: 4px;
  }
  .s3-week {
    font-size: 11px;
  }
  .s3-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
  }
  .s3-list {
    overflow: visible;
    flex: unset;
    gap: 7px;
  }

  .hero-badge {
    font-size: 10px;
    padding: 4px 10px;
  }
  .hero-name {
    font-size: 15px;
  }
  .hero-meta {
    font-size: 11px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .hero-time {
    font-size: 26px;
  }
  .hero-time-block {
    align-self: flex-end;
  }

  .course-row {
    padding: 9px 10px 9px 14px;
    gap: 8px;
  }
  .c-day {
    min-width: 55px;
    font-size: 11px;
  }
  .c-sep {
    height: 26px;
  }
  .c-name {
    font-size: 13px;
  }
  .c-teacher {
    font-size: 11px;
  }
  .c-time {
    font-size: 16px;
  }
  .c-location {
    font-size: 10px;
  }
}
