/* Réveil Rigolo — style.css
   UI minimaliste, 4 onglets, gros boutons tactiles. */

/* Shell — v4.7 : scroll par body natif */
.rr-shell {
  display: block;
  max-width: 480px;
  margin: 0 auto;
  background: var(--rr-bg);
}
.rr-main {
  display: block;
  padding: 16px;
  /* Place pour la nav fixe en bas */
  padding-bottom: 140px;
  box-sizing: border-box;
}

/* Navigation bottom */
.rr-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(22, 22, 48, .95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--rr-border);
  display: flex;
  padding: 8px 4px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}
.rr-nav-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--rr-text-mute);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 8px;
  font-size: .75rem;
  transition: color .15s, background .15s;
}
.rr-nav-btn.active { color: var(--rr-primary); background: rgba(255, 107, 53, .08); }
.rr-nav-icon { font-size: 1.4rem; }
.rr-nav-label { font-weight: 600; }

/* Section */
.rr-section { display: flex; flex-direction: column; gap: 16px; }

/* ─── ONGLET ALARM ────────────────────────────────────────────────────────── */
.rr-time-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #161630, #1f1f3d);
  border: 1px solid var(--rr-border);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: var(--rr-shadow);
}
.rr-time-input {
  background: transparent;
  border: none;
  color: var(--rr-primary);
  font-size: 3.2rem;
  font-weight: 800;
  width: 50%;
  padding: 0;
  letter-spacing: -1px;
  cursor: pointer;
}
.rr-time-input::-webkit-calendar-picker-indicator {
  filter: invert(60%) sepia(80%) saturate(800%) hue-rotate(330deg);
  cursor: pointer;
}
.rr-onoff {
  padding: 14px 24px;
  border-radius: 24px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 1px;
  border: none;
}
.rr-onoff.on  { background: var(--rr-primary); color: #fff; box-shadow: 0 0 20px rgba(255, 107, 53, .5); }
.rr-onoff.off { background: var(--rr-bg-card); color: var(--rr-text-mute); border: 1px solid var(--rr-border); }

.rr-next-alarm {
  text-align: center;
  color: var(--rr-text-mute);
  font-size: .9rem;
  margin: 0;
}

.rr-mode-wrap {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  background: var(--rr-bg-soft);
  padding: 10px;
  border-radius: 12px;
}
.rr-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--rr-text-mute);
  transition: all .15s;
}
.rr-mode-btn.active {
  background: rgba(255, 107, 53, .12);
  border-color: var(--rr-primary);
  color: var(--rr-primary);
}
.rr-mode-icon { font-size: 1.4rem; }
.rr-mode-label { font-size: .65rem; text-align: center; line-height: 1.1; }

.rr-preview {
  background: var(--rr-bg-soft);
  border-radius: 12px;
  padding: 16px;
  border-left: 4px solid var(--rr-primary);
}
.rr-preview-title { font-weight: 700; font-size: 1rem; margin-bottom: 6px; color: #ffffff; }
.rr-preview-content { color: #ddd; font-size: .95rem; margin-bottom: 10px; }
.rr-preview-answer { font-weight: 800; color: var(--rr-primary); padding: 8px 12px; background: rgba(255, 107, 53, .12); border-radius: 8px; margin-top: 8px; }

.rr-reveal {
  background: transparent;
  border: 1px dashed var(--rr-text-mute);
  color: var(--rr-text-mute);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .85rem;
}
.rr-reveal:hover { color: var(--rr-primary); border-color: var(--rr-primary); }

.rr-btn {
  display: inline-block;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
}
.rr-btn:active { transform: scale(.98); }
.rr-btn-primary { background: var(--rr-primary); color: #fff; }
.rr-btn-primary:hover { background: var(--rr-primary-h); }
.rr-btn-secondary { background: var(--rr-bg-card); color: #fff; border: 1px solid var(--rr-border); }
.rr-btn-premium { background: linear-gradient(135deg, #ff6b35, #ffae00); color: #fff; }
.rr-btn-ghost { background: transparent; color: var(--rr-text-mute); border: 1px solid var(--rr-border); }
.rr-btn-danger { background: var(--rr-danger); color: #fff; }

.rr-vol-wrap, .rr-bed-wrap, .rr-snooze-wrap, .rr-wd-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--rr-bg-soft);
  padding: 12px;
  border-radius: 12px;
}
.rr-vol-wrap > label, .rr-bed-wrap > label, .rr-snooze-wrap > label, .rr-wd-wrap > label {
  font-size: .85rem;
  color: var(--rr-text-mute);
  width: 100%;
  font-weight: 600;
}
.rr-vol-btn, .rr-snooze-btn, .rr-wd-btn {
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--rr-bg-card);
  color: #fff;
  border: 1px solid var(--rr-border);
  font-size: .85rem;
}
.rr-vol-btn.active, .rr-snooze-btn.active, .rr-wd-btn.active {
  background: var(--rr-primary);
  border-color: var(--rr-primary);
}

/* Switch */
.rr-switch {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 26px;
  border-radius: 14px;
  background: var(--rr-border);
  position: relative;
  cursor: pointer;
  transition: background .2s;
}
.rr-switch:checked { background: var(--rr-primary); }
.rr-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: left .2s;
}
.rr-switch:checked::after { left: 21px; }
.rr-switch-label { flex: 1; font-size: .9rem; }

/* ─── ONGLET MESSAGES ─────────────────────────────────────────────────────── */
.rr-sub-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}
.rr-sub-tabs::-webkit-scrollbar { display: none; }
.rr-sub-btn {
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--rr-bg-card);
  color: var(--rr-text-mute);
  border: 1px solid var(--rr-border);
  white-space: nowrap;
  font-size: .85rem;
}
.rr-sub-btn.active { background: var(--rr-primary); color: #fff; border-color: var(--rr-primary); }

.rr-msg-list { display: flex; flex-direction: column; gap: 10px; }
.rr-msg-card {
  background: var(--rr-bg-soft);
  border-radius: 12px;
  padding: 14px;
}
.rr-msg-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rr-msg-card-title { font-weight: 700; font-size: .95rem; }
.rr-msg-card-content { color: #ddd; font-size: .9rem; }
.rr-msg-card-answer { font-weight: 800; color: var(--rr-primary); padding: 8px 12px; background: rgba(255, 107, 53, .12); border-radius: 8px; margin-top: 8px; }
.rr-fav {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--rr-text-mute);
}
.rr-fav.on { color: #ffd700; }

/* Share bar */
.rr-share-bar {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.rr-share-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--rr-bg-card);
  border: 1px solid var(--rr-border);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
}
.rr-share-fb    { background: #1877f2; border-color: #1877f2; }
.rr-share-tw    { background: #000;    border-color: #000; }
.rr-share-wa    { background: #25d366; border-color: #25d366; }
.rr-share-tg    { background: #0088cc; border-color: #0088cc; }
.rr-share-copy  { background: var(--rr-bg-card); }
.rr-share-native{ background: var(--rr-primary); border-color: var(--rr-primary); }

/* ─── ONGLET SETTINGS ─────────────────────────────────────────────────────── */
.rr-setting-block {
  background: var(--rr-bg-soft);
  border-radius: 12px;
  padding: 16px;
  /* Permettre le scroll horizontal si besoin (ex: color pickers) */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rr-setting-block h3 { margin: 0 0 12px; font-size: 1rem; }
.rr-lang-group { display: flex; gap: 6px; flex-wrap: wrap; }
.rr-lang-btn {
  flex: 1 1 auto;
  min-width: 80px;
  padding: 12px;
  border-radius: 8px;
  background: var(--rr-bg-card);
  color: var(--rr-text, #fff);
  border: 1px solid var(--rr-border);
  font-size: .9rem;
  white-space: nowrap;
}
.rr-lang-btn.active { background: var(--rr-primary); border-color: var(--rr-primary); color: #fff; }

/* ─── ONGLET ACCOUNT ──────────────────────────────────────────────────────── */
.rr-hello { background: var(--rr-bg-soft); border-radius: 12px; padding: 14px; font-size: 1.1rem; font-weight: 700; }
.rr-streak-block { background: linear-gradient(135deg, #2a1a05, #3a2308); border-radius: 12px; padding: 16px; text-align: center; }
.rr-streak-num { font-size: 2.4rem; font-weight: 800; color: #ffae00; }
.rr-streak-best { color: #ffd700; font-size: .85rem; margin-top: 4px; }

.rr-premium-block {
  background: linear-gradient(135deg, rgba(255, 107, 53, .1), rgba(255, 174, 0, .1));
  border: 1px solid rgba(255, 107, 53, .3);
  border-radius: 12px;
  padding: 16px;
}
.rr-premium-block h3 { margin: 0 0 8px; color: var(--rr-primary); }
.rr-premium-block p { color: #ddd; font-size: .9rem; margin: 0 0 12px; }
.rr-premium-ok { background: rgba(74, 222, 128, .15); color: var(--rr-success); padding: 12px; border-radius: 8px; text-align: center; font-weight: 700; }

/* ─── MODALES ─────────────────────────────────────────────────────────────── */
.rr-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.rr-modal {
  background: var(--rr-bg-soft);
  border-radius: 16px;
  padding: 24px;
  max-width: 380px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.rr-modal h2 { margin: 0 0 12px; font-size: 1.2rem; }
.rr-modal p { color: var(--rr-text-mute); font-size: .85rem; margin: 0 0 16px; }

.rr-rec-progress {
  height: 6px;
  background: var(--rr-bg-card);
  border-radius: 3px;
  overflow: hidden;
  margin: 16px 0 8px;
}
.rr-rec-bar { height: 100%; background: var(--rr-primary); width: 0; transition: width .2s linear; }
.rr-rec-time { text-align: center; font-size: 1.4rem; font-weight: 700; margin-bottom: 16px; color: var(--rr-primary); }
.rr-rec-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.rr-text-input, .rr-submit-title, .rr-submit-content, .rr-submit-answer, .rr-submit-type {
  width: 100%;
  background: var(--rr-bg-card);
  border: 1px solid var(--rr-border);
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.rr-text-input { min-height: 120px; resize: vertical; }
.rr-text-actions, .rr-submit-actions { display: flex; gap: 8px; }
.rr-submit-status { margin-top: 12px; font-size: .85rem; }

/* ─── ALARME OVERLAY ──────────────────────────────────────────────────────── */
.rr-alarm-modal {
  background: linear-gradient(135deg, #ff6b35, #ffae00);
  text-align: center;
  animation: rr-pulse 1s ease-in-out infinite;
}
@keyframes rr-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
.rr-alarm-modal h2 { color: #fff; font-size: 2.4rem; }
.rr-alarm-modal p { color: #fff; font-size: 1rem; }
.rr-alarm-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.rr-alarm-actions .rr-btn { padding: 16px; font-size: 1.05rem; }

/* ─── AD ──────────────────────────────────────────────────────────────────── */
.rr-ad {
  background: #fff;
  color: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid #ddd;
}
.rr-ad-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .7rem; color: #888; padding: 4px 8px; background: #f5f5f5;
}
.rr-ad-close { background: transparent; border: none; color: #888; font-size: .8rem; cursor: pointer; }
.rr-ad-body { padding: 8px; }

/* ─── TOAST ────────────────────────────────────────────────────────────────── */
.rr-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--rr-success);
  color: #0a0a1a;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .85rem;
  z-index: 99999;
  animation: rr-fade 1.5s forwards;
}
@keyframes rr-fade {
  0% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* ─── EMPTY ───────────────────────────────────────────────────────────────── */
.rr-empty { text-align: center; color: var(--rr-text-mute); padding: 30px; font-size: .9rem; }

/* ─── FRIENDS (injecté par friends.js) ────────────────────────────────────── */
.rr-friends-block { background: var(--rr-bg-soft); border-radius: 12px; padding: 14px; margin-top: 10px; }
.rr-friends-block h3 { margin: 0 0 10px; font-size: 1rem; }
.rr-friends-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.rr-friends-member { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--rr-border); font-size: .9rem; }
.rr-friends-actions { display: flex; gap: 6px; margin-top: 8px; }
.rr-friends-code { font-family: monospace; font-size: 1.2rem; font-weight: 700; color: var(--rr-primary); padding: 8px 12px; background: var(--rr-bg-card); border-radius: 8px; text-align: center; }

/* Responsive */
@media (max-width: 360px) {
  .rr-time-input { font-size: 2.4rem; }
  .rr-mode-label { font-size: .6rem; }
}
@media (min-width: 481px) {
  .rr-shell { border-left: 1px solid var(--rr-border); border-right: 1px solid var(--rr-border); }
}

/* ── Bloc "Comment ça marche" (v5.2) ────────────────────────────────────────── */
.rr-howto {
  background: var(--rr-bg-soft);
  border-radius: 12px;
  padding: 18px;
  border-left: 4px solid var(--rr-primary);
}
.rr-howto h3 {
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 12px 0;
}
.rr-howto-content {
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.6;
}
.rr-howto-content p {
  color: #ffffff;
  margin: 0 0 12px 0;
}
.rr-howto-content ul,
.rr-howto-content ol {
  color: #ffffff;
  margin: 0 0 12px 0;
  padding-left: 24px;
}
.rr-howto-content li {
  color: #ffffff;
  margin-bottom: 6px;
  line-height: 1.5;
}
.rr-howto-content strong {
  color: var(--rr-primary);
  font-weight: 700;
}
.rr-howto-content em {
  color: #ffae00;
  font-style: italic;
}
.rr-howto-content code {
  background: #1f1f3d;
  color: #7ee0ff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* ── v5.5 : Horloge temps réel + molettes ───────────────────────────────────── */
.rr-real-time-wrap {
  text-align: center;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--rr-bg-soft);
  border-radius: 12px;
}
.rr-real-time-label {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rr-real-time {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
}

.rr-time-wheel {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  padding: 8px 8px;
  background: var(--rr-bg-soft);
  border-radius: 12px;
}
.rr-wheel {
  width: 70px;
  height: 132px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  scroll-padding: 44px;
  background-image: linear-gradient(
    to bottom,
    transparent 0%,
    transparent calc(50% - 22px),
    rgba(255, 107, 53, 0.15) calc(50% - 22px),
    rgba(255, 107, 53, 0.15) calc(50% + 22px),
    transparent calc(50% + 22px),
    transparent 100%
  );
  border-top: 1px solid var(--rr-border);
  border-bottom: 1px solid var(--rr-border);
}
.rr-wheel::-webkit-scrollbar { display: none; }
.rr-wheel-item {
  height: 44px;
  line-height: 44px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: #666;
  scroll-snap-align: center;
  transition: color 0.2s, font-size 0.2s;
}
.rr-wheel-item.selected {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}
.rr-wheel-colon {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  align-self: center;
}

/* ── v5.5.1 : Label "Réveille-moi à :" + message info ──────────────────────── */
.rr-wake-label {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  margin: 6px 0 2px 0;
}
.rr-alarm-info {
  text-align: center;
  font-size: 0.8rem;
  color: var(--rr-success);
  background: rgba(74, 222, 128, 0.12);
  padding: 6px 12px;
  border-radius: 8px;
  margin-top: 4px;
  border: 1px solid rgba(74, 222, 128, 0.3);
}
