/* ============================================================
   LAYOUT.CSS — Проект «Икра» · v410
   ============================================================ */

/* === SCREEN SWITCHING === */
.screen { display:none; flex:1; flex-direction:column; min-height:0; min-width:0; width:100%; max-width:100%; }
.screen.active { display:flex; animation:slideIn .24s cubic-bezier(.16,1,.3,1); }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideInLeft { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.read-slide-next { animation: slideInRight .25s ease-out; }
.read-slide-prev { animation: slideInLeft .25s ease-out; }

/* === HEADER === */
.header { display:flex; align-items:center; justify-content:space-between; padding: var(--space-2) var(--space-3); gap: var(--space-2); min-height:56px; }
.header h1 { font-family:"Inter", system-ui, sans-serif; font-size: var(--fs-lg); font-weight: 600; margin:0; letter-spacing:-.02em; line-height:1.2; }

/* === SCROLL CONTAINERS === */
.list, .form, .cal, .settings { flex:1; overflow-y:auto; min-height:0; padding:0 var(--space-3) calc(var(--space-4) + var(--nav-height) + env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling:touch; min-width:0; width:100%; max-width:100%; box-sizing:border-box; }
.content-list { flex:1; overflow-y:auto; min-height:0; padding:0 var(--space-3) calc(var(--space-4) + var(--nav-height) + env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling:touch; min-width:0; width:100%; max-width:100%; box-sizing:border-box; }
.detail-body { padding:0 var(--space-4) calc(var(--space-4) + var(--nav-height) + env(safe-area-inset-bottom, 0px)); flex:1; overflow-y:auto; min-height:0; -webkit-overflow-scrolling:touch; min-width:0; width:100%; max-width:100%; box-sizing:border-box; }

.home-controls { display:flex; gap: var(--space-2); margin-bottom: var(--space-2); flex-wrap:wrap; }
#cards-container { min-height:24px; }


/* === TOP PROGRESS === */
.top-progress { position:fixed; top:0; left:0; right:0; height:3px; z-index:5; pointer-events:none; }
.top-progress > div { height:100%; width:100%; transform: scaleX(0); transform-origin: left center; background: var(--gold-standard); transition: transform .3s ease; }

/* === COUNTER === */
.counter { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-start; padding: var(--space-4) var(--space-3) calc(var(--space-4) + var(--nav-height) + env(safe-area-inset-bottom, 0px)); text-align:center; position:relative; cursor:pointer; overflow-x:hidden; overflow-y:auto; -webkit-overflow-scrolling:touch; min-height:0; min-width:0; width:100%; max-width:100%; box-sizing:border-box; }

/* === FULLSCREEN === */
.fullscreen { position:fixed; inset:0; background:var(--bg); z-index:10000; display:none; flex-direction:column; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.fullscreen.active { display:flex; animation: slideUp .26s cubic-bezier(.16,1,.3,1); }
.fullscreen .fs-header {
  display:flex; align-items:center; justify-content:space-between;
  padding: var(--space-2) var(--space-3); border-bottom:1px solid var(--border); gap: var(--space-2);
  background: rgba(var(--bg-rgb, 0,0,0), 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
  transition: transform var(--dur-base) var(--ease-out);
  will-change: transform;
}
.fullscreen .fs-header.fs-header-hidden { transform: translateY(-100%); }
.fullscreen .fs-header h2 { font-family:"Inter", system-ui, sans-serif; font-size: var(--fs-sm); margin:0; font-weight:300; letter-spacing:-.01em; overflow-wrap: break-word; }
.fullscreen .fs-header input { flex:1; min-width:0; background:var(--card); border:1px solid var(--border); border-radius:12px; padding: var(--space-2) var(--space-3); font-size: var(--fs-sm); outline:none; color:var(--text); margin:0 var(--space-2); -webkit-user-select:text; user-select:text; }
.fullscreen .fs-body { flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; min-height:0; padding: var(--space-4) var(--space-4) calc(var(--space-4) + var(--nav-height) + env(safe-area-inset-bottom, 0px)); overflow-wrap: anywhere; min-width:0; width:100%; max-width:100%; box-sizing:border-box; }
.fullscreen .fs-nav { display:flex; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-top:1px solid var(--border); }
.fullscreen .fs-nav .btn { margin:0; flex:1; }

/* === ONBOARDING === */
#onboarding { position: fixed; inset: 0; background: var(--bg); z-index: 99999; display: none; flex-direction: column; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
#onboarding.active { display: flex; animation: fadeIn .3s ease; }
#onboarding .ob-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px var(--space-4); text-align: center; overflow-y: auto; }
#onboarding .ob-options { display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; margin-bottom: var(--space-4); }
#onboarding .ob-nav { display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); max-width: 420px; width: 100%; margin: 0 auto; }
#onboarding .ob-dots { display: flex; gap: 6px; justify-content: center; padding: 0 0 var(--space-2); }

/* === DASH HEADER === */
.dash-header { align-items: center; justify-content: flex-end; padding: var(--space-2) var(--space-3) var(--space-1); gap: var(--space-2); min-height: 48px; }
.dash-header-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.dash-salam { font-size: var(--fs-sm); font-weight: 600; color: var(--text); line-height: 1.35; overflow-wrap: break-word; max-width: 100%; }
.dash-hijri-gold { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .2px; line-height: 1.3; min-height: 1em; }
.dash-header-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-start; }
@media (max-width: 380px) {
  .dash-salam { font-size: var(--fs-xs); }
  .dash-hijri-gold { font-size: var(--fs-xs); }
}

/* === DASH GREETING BLOCK === */
.dash-greeting-block {
  width: 100%;
  text-align: center;
  margin: 0 0 24px;
  padding: 0 var(--space-2);
}
.dash-greeting-block .dash-salam-subtle {
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.dash-greeting-block .dash-hijri-gold {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.2px;
  line-height: 1.5;
  margin-top: 6px;
}

/* === DASH GRID 2x2 === */
.dash-grid-2x2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-bottom: var(--space-4); }

/* === STAT GRID === */
.stat-grid { display:grid; grid-template-columns:1fr 1fr; gap: var(--space-2); margin-bottom: var(--space-3); }

/* === CAL GRID === */
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; background:var(--card); border-radius:16px; padding: var(--space-2); }

/* === COUNTER padding override === */
.counter { padding-bottom: calc(var(--space-4) + var(--nav-safe)); }

/* === PATH TAB: chips wrapper === */
.path-chips-wrapper { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
#path-chips-container {
  display: flex; flex-direction: row; flex-wrap: nowrap;
  overflow-x: auto; justify-content: flex-start;
  gap: var(--space-2); 
  padding: 4px var(--space-3) 6px var(--space-3);
  box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%;
  border-bottom: none; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
#path-chips-container::-webkit-scrollbar { display: none; }

/* === SPLASH SCREEN === */
#splash-screen {
  position: fixed; inset: 0; background: var(--bg); z-index: 999999;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
}
#splash-screen.hidden { opacity: 0; pointer-events: none; }
#splash-screen img { max-width: 120px; max-height: 120px; width: 100%; height: auto; aspect-ratio: 1/1; object-fit: contain; }

/* ============================================================
   IQRA V412 — НАВИГАЦИЯ И ОБЩАЯ ГЕОМЕТРИЯ ЭКРАНОВ
   ============================================================ */
.header {
  min-height: 62px;
  padding: 10px clamp(16px, 4vw, 22px);
  gap: 12px;
}

.header h1 {
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

/* Заголовок детального экрана остаётся точно по центру между действиями. */
#screen-quran-detail > .header,
#screen-night-detail > .header,
#screen-dua-detail > .header,
#screen-hadith-detail > .header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
}

#screen-quran-detail > .header h1,
#screen-night-detail > .header h1,
#screen-dua-detail > .header h1,
#screen-hadith-detail > .header h1 {
  grid-column: 2;
  min-width: 0;
  text-align: center;
  justify-self: stretch;
  overflow-wrap: anywhere;
}

#screen-quran-detail > .header > :first-child,
#screen-night-detail > .header > :first-child,
#screen-dua-detail > .header > :first-child,
#screen-hadith-detail > .header > :first-child { grid-column: 1; grid-row: 1; }

#screen-quran-detail > .header > :last-child,
#screen-night-detail > .header > :last-child,
#screen-dua-detail > .header > :last-child,
#screen-hadith-detail > .header > :last-child { grid-column: 3; grid-row: 1; }

.header .icon-btn.ghost {
  background: var(--nav-active-surface);
  border: 1px solid var(--nav-border);
  color: var(--gold-text-light);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

[data-theme="dark"] .header .icon-btn.ghost,
[data-theme="mono"] .header .icon-btn.ghost {
  color: var(--gold-text-dark);
}

/* Нижняя навигация — спокойная стеклянная панель с ясным состоянием выбора. */
.nav {
  display: flex;
  flex-shrink: 0;
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 720px;
  height: calc(72px + var(--safe-bottom));
  margin: 0 auto;
  padding: 8px max(12px, var(--safe-left)) calc(8px + var(--safe-bottom)) max(12px, var(--safe-right));
  gap: clamp(4px, 1.4vw, 10px);
  background: var(--nav-surface);
  border: 1px solid var(--nav-border);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
}

.nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 1 1 0%;
  min-width: 0;
  min-height: 52px;
  padding: 6px 3px 7px;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--nav-muted);
  opacity: 1;
  transition: color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.nav button .ico {
  width: 24px;
  height: 24px;
  background: none;
  box-shadow: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  opacity: 0.96;
  transition: transform var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}

.nav button .nav-label {
  max-width: 100%;
  color: currentColor;
  font-size: clamp(10px, 2.5vw, 11px);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav button.active {
  color: var(--gold-text-light);
  opacity: 1;
  background: var(--nav-active-surface);
  border-color: var(--nav-active-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 8px rgba(0, 0, 0, 0.045);
}

.nav button.active::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 50%;
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold-standard);
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.22);
}

.nav button.active .ico {
  color: currentColor;
  transform: translateY(-1px);
}

.nav button.active .nav-label {
  color: currentColor;
  font-weight: 700;
}

.nav button:focus-visible {
  outline: 2px solid var(--gold-standard);
  outline-offset: -2px;
}

[data-theme="dark"] .nav button.active,
[data-theme="mono"] .nav button.active {
  color: var(--gold-text-dark);
}

[data-theme="dark"] .nav,
[data-theme="mono"] .nav {
  background: var(--nav-surface);
  border-color: var(--nav-border);
  border-bottom: 0;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .nav { background: var(--nav-surface); border-color: var(--nav-border); border-bottom: 0; }
  html:not([data-theme]) .nav button.active { color: var(--gold-text-dark); }
}

/* Кнопки управления в полноэкранном чтении — симметричная нижняя панель. */
.fs-bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(44px, 1fr));
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 9px 18px calc(9px + var(--safe-bottom));
  border-top: 1px solid var(--nav-border);
  background: var(--nav-surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.fs-bottom-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--card-outline);
  border-radius: 50%;
  background: var(--card);
  color: var(--gold-text-light);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.fs-bottom-nav button .ico { width: 21px; height: 21px; }
[data-theme="dark"] .fs-bottom-nav button,
[data-theme="mono"] .fs-bottom-nav button { color: var(--gold-text-dark); }

.fullscreen .fs-nav {
  padding: 12px 16px calc(12px + var(--safe-bottom));
  gap: 10px;
  background: var(--nav-surface);
  border-top-color: var(--nav-border);
}

@media (max-width: 360px) {
  .nav { padding-left: 8px; padding-right: 8px; gap: 2px; }
  .nav button { min-height: 50px; padding-inline: 1px; }
  .nav button .ico { width: 22px; height: 22px; }
  .nav button .nav-label { font-size: 9px; }
  .header { padding-inline: 12px; }
}

@media (min-width: 768px) {
  .nav { border-left: 1px solid var(--nav-border); border-right: 1px solid var(--nav-border); }
}
