/* =============================================
   NATHALIYA RESTAURANT — Telegram Mini App
   Olive / Mediterranean Theme
   ============================================= */

:root {
  --bg:           #f5f3ec;
  --olive:        #6b7b3d;
  --olive-dark:   #4f5d2f;
  --olive-deep:   #3a4422;
  --olive-light:  #a3b18a;
  --olive-pale:   #dce5c8;
  --olive-mist:   #edf0e4;
  --accent:       #c9a84c;
  --accent-warm:  #e8c96a;
  --text:         #2f3a1f;
  --text-soft:    #6b7b5a;
  --white:        #fdfcf8;
  --shadow:       rgba(79, 93, 47, 0.18);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Jost', system-ui, sans-serif;

  --radius:       14px;
  --radius-sm:    8px;
  --header-h:     64px;
  --controls-h:   72px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* =============================================
   LANGUAGE SCREEN
   ============================================= */

#languageScreen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--olive-deep);
  z-index: 100;
  overflow: hidden;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#languageScreen.fade-out {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.lang-bg-texture {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(163, 177, 138, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(201, 168, 76, 0.1) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23a3b18a' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.lang-content {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 40px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

.lang-logo {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.lang-logo-leaf {
  font-size: 40px;
  margin-bottom: 4px;
  filter: drop-shadow(0 4px 12px rgba(201, 168, 76, 0.4));
  animation: leafFloat 3s ease-in-out infinite;
}

@keyframes leafFloat {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-6px) rotate(5deg); }
}

.lang-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--white);
  letter-spacing: 0.5px;
  text-align: center;
}

.lang-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-warm);
}

.lang-subtitle {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 300;
  color: var(--olive-light);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 4px;
}

.lang-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lang-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(163, 177, 138, 0.25);
  border-radius: var(--radius);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  backdrop-filter: blur(6px);
  position: relative;
  overflow: hidden;
}

.lang-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(163, 177, 138, 0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.lang-btn:hover::before,
.lang-btn:active::before {
  opacity: 1;
}

.lang-btn:active {
  transform: scale(0.98);
  border-color: var(--accent);
}

.lang-flag {
  font-size: 22px;
  line-height: 1;
}

.lang-name {
  flex: 1;
  text-align: left;
  letter-spacing: 0.3px;
}

.lang-arrow {
  color: var(--olive-light);
  font-size: 18px;
  transition: transform 0.2s, color 0.2s;
}

.lang-btn:hover .lang-arrow {
  transform: translateX(4px);
  color: var(--accent-warm);
}

.lang-footer {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: rgba(163, 177, 138, 0.6);
  letter-spacing: 0.5px;
}

/* =============================================
   MAIN APP
   ============================================= */

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transition: opacity 0.4s ease;
}

#app.hidden {
  display: none;
}

#app.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

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

/* ---- Header ---- */

#appHeader {
  flex: 0 0 var(--header-h);
  background: var(--olive-deep);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 12px var(--shadow);
  position: relative;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.header-leaf {
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(201,168,76,0.4));
}

.header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.header-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 12px;
  color: var(--olive-light);
  letter-spacing: 0.5px;
}

.lang-switch-btn {
  background: rgba(163, 177, 138, 0.18);
  border: 1px solid rgba(163, 177, 138, 0.3);
  border-radius: var(--radius-sm);
  color: var(--olive-light);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.lang-switch-btn:active {
  background: rgba(163, 177, 138, 0.3);
  color: var(--accent-warm);
}

/* ---- Viewer ---- */

#viewer {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--olive-mist);
}

#pageWrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#menuPage {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(79, 93, 47, 0.15);
  transition: opacity 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
}

#menuPage.loading {
  opacity: 0;
}

.page-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.page-loader.active {
  opacity: 1;
}

.loader-ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--olive-pale);
  border-top-color: var(--olive);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Controls ---- */

#controls {
  flex: 0 0 var(--controls-h);
  background: var(--white);
  border-top: 1px solid var(--olive-pale);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  padding-bottom: env(safe-area-inset-bottom);
  gap: 12px;
  box-shadow: 0 -2px 12px rgba(79, 93, 47, 0.08);
}

.nav-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--olive-pale);
  background: var(--olive-mist);
  color: var(--olive-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  flex-shrink: 0;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
}

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

.nav-btn:active {
  transform: scale(0.92);
  background: var(--olive);
  color: var(--white);
  border-color: var(--olive);
  box-shadow: 0 4px 12px var(--shadow);
}

.nav-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.page-indicator {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-display);
  color: var(--olive-dark);
}

#currentPage {
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  color: var(--olive-deep);
  min-width: 28px;
  text-align: right;
}

.page-sep {
  font-size: 18px;
  color: var(--olive-light);
}

#totalPages {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-soft);
  min-width: 20px;
}

/* =============================================
   PAGE TRANSITION ANIMATIONS
   New image slides in from the side — no opacity flicker
   ============================================= */

#menuPage.swipe-left {
  animation: slideInFromRight 0.28s ease forwards;
}

#menuPage.swipe-right {
  animation: slideInFromLeft 0.28s ease forwards;
}

@keyframes slideInFromRight {
  0%   { opacity: 0; transform: translateX(40px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes slideInFromLeft {
  0%   { opacity: 0; transform: translateX(-40px); }
  100% { opacity: 1; transform: translateX(0); }
}
