/* ==========================================
   APP.CSS - Structură generală, Layout, Topbar & Side Rail
   ========================================== */

:root{
  --bg-room:      #241A14;
  --bg-ticket:    #FFF3E0;
  --card-bg:      #FFFBF5;
  --ink:          #241A14;
  --ink-soft:     #6B5B4E;
  --flame:        #E1462A;
  --flame-dark:   #B8341C;
  --mustard:      #F2A93B;
  --olive:        #5C7A4E;
  --line:         #D8C9B8;

  --shadow-card:  0 8px 24px rgba(36,26,20,0.06), 0 2px 6px rgba(36,26,20,0.04);
  --shadow-btn:   0 6px 16px rgba(225,70,42,0.25);
  
  --radius-card:  20px;
  --radius-btn:   14px;
  --radius-pill:  999px;

  --font-display: 'Alfa Slab One', serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;

  --dur-fast:     150ms;
  --dur-med:      300ms;
  --ease-fluid:   cubic-bezier(0.2, 0.8, 0.2, 1);
  --topbar-h:     72px;
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html{ -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body{
  margin:0; min-height:100vh;
  background: var(--bg-room);
  background-image: radial-gradient(ellipse at top, rgba(255,255,255,0.03), transparent 60%);
  font-family: var(--font-body); color: var(--ink);
  display:flex; justify-content:center;
}
button, input, textarea { font-family: inherit; }
button{ cursor:pointer; border:none; background:none; padding:0; margin:0; }
:focus-visible{ outline: 2px solid var(--mustard); outline-offset: 2px; }

/* ---------------- Structura Bazei (Biletul) ---------------- */
.ticket-wrap{
  position:relative; width:100%; max-width:480px; min-height:100vh;
  background: var(--bg-ticket);
  display: flex; flex-direction: column;
  overflow-x: hidden;
  padding-top: var(--topbar-h);
  padding-bottom: 90px;
  transition: padding-bottom var(--dur-med);
}
body.has-cart .ticket-wrap {
  padding-bottom: 160px;
}

.tear{
  position:absolute; left:0; right:0; height:14px; z-index:5; pointer-events: none;
  background-image:
    linear-gradient(45deg, var(--bg-room) 50%, transparent 50%),
    linear-gradient(-45deg, var(--bg-room) 50%, transparent 50%);
  background-position: 0 0, 7px 0; background-size:14px 14px; background-repeat:repeat-x;
}
.tear-top{ top:0; } 
.tear-bottom{ bottom:0; transform:scaleY(-1); }

/* ---------------- Header Complet Fix cu Blur Dinamic la Scroll ---------------- */
.topbar{
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  background: rgba(255, 243, 224, 0.85);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display:flex; align-items:center; justify-content:space-between;
  height: var(--topbar-h); padding: 0 16px;
  border-bottom: 1px solid rgba(36,26,20,0.06);
  box-shadow: 0 4px 20px rgba(36,26,20,0);
  transition: background 250ms ease, box-shadow 250ms ease, border-color 250ms ease;
}

body.compact-mode .topbar,
body:not(.compact-mode) .topbar.scrolled {
  background: rgba(255, 243, 224, 0.92);
  border-bottom-color: rgba(36,26,20,0.12);
  box-shadow: 0 6px 20px rgba(36,26,20,0.08);
}

.topbar-left { display: flex; align-items: center; gap: 10px; }
.logo-box {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--flame); color: #fff; font-family: var(--font-display);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  box-shadow: var(--shadow-btn);
}
.topbar-info { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.2px; line-height: 1.1; }

.location-trigger {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; color: var(--flame);
  background: rgba(225,70,42,0.1); padding: 4px 8px;
  border-radius: 8px; margin-top: 3px;
  transition: transform var(--dur-fast);
}
.location-trigger:active { transform: scale(0.95); }
.location-trigger svg { width: 14px; height: 14px; stroke-width: 2.5; }

.topbar-right { display: flex; align-items: center; gap: 2px; }
.icon-btn{
  width:40px; height:40px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; color: var(--ink);
  transition: transform var(--dur-fast); position:relative;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg{ width:24px; height:24px; stroke-width: 1.8; }

.cart-badge{
  position:absolute; top:4px; right:4px; min-width:18px; height:18px; padding:0 4px;
  border-radius:50%; background: var(--flame); color:#fff; font-size:10px; font-weight:700;
  display:flex; align-items:center; justify-content:center; font-family: var(--font-mono);
  transform: scale(0); transition: transform var(--dur-med) var(--ease-fluid);
}
.cart-badge.show{ transform: scale(1); }

/* ---------------- Slider cu tranziție fluidă ---------------- */
.slider-wrapper {
  overflow: hidden;
  max-height: 180px;
  opacity: 1;
  transform: translateY(0);
  transition: transform 250ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 250ms cubic-bezier(0.22, 1, 0.36, 1),
              max-height 250ms cubic-bezier(0.22, 1, 0.36, 1),
              padding 250ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity, max-height;
}

body.compact-mode .slider-wrapper {
  transform: translateY(-20px);
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  pointer-events: none;
}

/* ---------------- Layout: Side Rail + Main Content & Indicatori Săgeți ---------------- */
.body-split{ display:flex; align-items:flex-start; flex: 1; position: relative; }

.side-rail{
  position: fixed; 
  top: 250px; 
  left: max(0px, calc(50% - 240px));
  width: 64px;
  bottom: 40px; 
  background: var(--ink);
  border-radius: 0 28px 28px 0;
  padding: 24px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  box-shadow: 6px 0 24px rgba(36,26,20,0.2);
  z-index: 25;
  transition: top 250ms cubic-bezier(0.22, 1, 0.36, 1),
              bottom var(--dur-med) var(--ease-fluid);
}

body.compact-mode .side-rail {
  top: 92px;
}

body.has-cart .side-rail {
  bottom: 110px;
}

/* Săgeți pentru meniul derulant */
.rail-scroll-indicator {
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  letter-spacing: -1px;
}

.rail-cats { display: flex; flex-direction: column; gap: 10px; width: 100%; align-items: center; overflow-y: auto; scrollbar-width: none; padding: 0 8px; }
.rail-cats::-webkit-scrollbar { display: none; }

.rail-bottom-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; align-items: center; margin-top: 10px; }
.rail-divider { width: 28px; height: 2px; background: rgba(255,255,255,0.1); border-radius: 2px; }

.rail-item{
  width: 48px; height: 48px; border-radius: 16px; flex-shrink: 0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  transition: all var(--dur-med) var(--ease-fluid);
  color: rgba(255,255,255,0.7);
  position: relative;
}
.rail-item .emoji {
  font-size: 22px; line-height: 1; 
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
  transition: transform var(--dur-med) var(--ease-fluid);
}

.rail-item:active { transform: scale(0.9); }
.rail-item.active { background: rgba(255, 255, 255, 0.15); box-shadow: inset 0 2px 6px rgba(0,0,0,0.1); }
.rail-item.active .emoji { transform: scale(1.25); }

/* Stil special și separator pentru prima opțiune (Concurs) */
.rail-item[data-cat="concurs"] {
  border: 1.5px solid var(--mustard); 
  background: rgba(242,169,59,0.1);
  margin-bottom: 12px;
  position: relative;
}

.rail-item[data-cat="concurs"]::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 8px;
  right: 8px;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.rail-item[data-cat="concurs"].active { 
  background: var(--mustard); 
}

.rail-action-btn svg { width: 22px; height: 22px; opacity: 0.8; }
.rail-action-btn:active svg { opacity: 1; color: var(--mustard); }

.main-col{ 
  flex:1; min-width:0; padding: 12px 16px 40px 84px;
  transition: opacity var(--dur-med) var(--ease-fluid), transform var(--dur-med) var(--ease-fluid);
}
.main-col.fade-out { opacity: 0; transform: translateY(12px); }

/* ---------------- Footer Bon Fiscal Integrat ---------------- */
.ticket-footer {
  text-align: right; 
  padding: 30px 4px 10px;
  color: rgba(36,26,20,0.45); 
  font-family: var(--font-mono); 
  font-size: 10.5px; 
  font-weight: 600;
  letter-spacing: -0.2px;
  margin-top: 20px;
  border-top: 1px dashed var(--line);
}


/* ---------------- Overlay & Comunity Sheets Base ---------------- */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(36,26,20,0.6); z-index: 40;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-med) var(--ease-fluid);
}
.sheet-overlay.show { opacity: 1; pointer-events: auto; }
