/* ==========================================================
   BEAM Partner Toolkit — mobile & UX enhancements
   Φορτώνεται ΜΕΤΑ το styles.css. Μόνο προσθήκες/διορθώσεις.
   ========================================================== */

/* --- Διόρθωση: μην κόβονται τα chips του header στο κινητό --- */
@media (max-width: 900px) {
  .top-bar { row-gap: 0.45rem; }
  .quick-stats { min-width: 0; }
  .quick-stats .stat-chip {
    white-space: normal;
    line-height: 1.25;
    word-break: break-word;
    flex: 1 1 auto;
  }
  .stat-chip strong { white-space: nowrap; }
}

/* --- Sticky mobile summary bar --- */
#btm-bar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 70;
  background: #0f172a;
  color: #e2e8f0;
  border-top: 1px solid #1e293b;
  padding: 0.55rem 0.7rem calc(0.55rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.28);
  gap: 0.5rem;
  align-items: center;
}
@media (max-width: 900px) {
  #btm-bar.btm-show { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  body { padding-bottom: 0; }
  .content-body { padding-bottom: 5.2rem !important; }
}
#btm-bar .btm-info { min-width: 0; }
#btm-bar .btm-line1 {
  font-size: 0.72rem; letter-spacing: .04em; text-transform: uppercase;
  color: #94a3b8; font-weight: 700;
}
#btm-bar .btm-line2 {
  font-size: 1.02rem; font-weight: 800; color: #f8fafc;
  white-space: nowrap; line-height: 1.2;
}
#btm-bar .btm-line3 {
  font-size: 0.8rem; font-weight: 700; color: #34d399;
  white-space: nowrap; line-height: 1.2;
}
#btm-bar .btm-line2 .btm-prof { color: #34d399; }
#btm-bar .btm-actions { display: flex; gap: 0.35rem; align-items: center; }
#btm-bar .btm-btn {
  min-height: 40px; min-width: 40px;
  font-size: 0.82rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid #334155; background: #1e293b;
  color: #f1f5f9; font-size: 1rem; cursor: pointer; padding: 0 0.6rem;
}
#btm-bar .btm-btn.primary { background: var(--primary, #2563eb); border-color: var(--primary, #2563eb); color: #fff; font-weight: 700; padding: 0 0.7rem; }
#btm-bar .btm-btn:active { transform: scale(.97); }

/* --- Ένδειξη ότι ο πίνακας σύγκρισης σέρνεται οριζόντια --- */
@media (max-width: 900px) {
  .tier-table-wrapper { position: relative; }
  .tier-table-wrapper::after {
    content: '← σύρε για περισσότερα →';
    display: block; text-align: center;
    font-size: 0.72rem; color: var(--text-muted, #64748b);
    padding-top: 0.3rem;
  }
}

/* --- Λίγο μεγαλύτερες περιοχές αφής --- */
@media (max-width: 900px) {
  .opt-content { min-height: 52px; }
  .btn-sm { min-height: 40px; }
  select, input[type="text"], input[type="number"], textarea { font-size: 16px; }
}

/* --- Κουμπί "Νέα προσφορά" και στο desktop (top bar) --- */
.btm-desktop-new {
  display: none;
  flex: 0 0 auto; white-space: nowrap;
  align-items: center; gap: 0.35rem;
  min-height: 34px; padding: 0.3rem 0.7rem;
  border-radius: 999px; border: 1px solid var(--border, #e2e8f0);
  background: #fff; color: var(--text-main, #0f172a);
  font-size: 0.8rem; font-weight: 700; cursor: pointer;
}
.btm-desktop-new:hover { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
@media (min-width: 901px) {
  .btm-desktop-new { display: inline-flex; }
}

/* --- Toast πάνω από τη sticky bar --- */
@media (max-width: 900px) {
  .toast-container, #toast-container { bottom: calc(4.8rem + env(safe-area-inset-bottom)) !important; }
}

/* --- Desktop header: να μη σπάνε τα chips όταν προστίθεται το κουμπί --- */
@media (min-width: 901px) {
  .top-bar { gap: 0.9rem; }
  .page-info { min-width: 0; }
  .page-info h1, .page-info p { overflow: hidden; text-overflow: ellipsis; }
  .quick-stats { flex: 0 0 auto; }
  .quick-stats .stat-chip { flex: 0 0 auto; white-space: nowrap; }
}

/* ---------- Collapsible βήματα (μόνο κινητό/tablet) ---------- */
.btm-step-toggle { display: none; }
@media (max-width: 900px) {
  .q-box.q-collapsed .options-grid { display: none; }
  .q-box .q-header { cursor: pointer; }
  .btm-step-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; flex: 0 0 auto;
    width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid var(--border, #e2e8f0); background: #fff;
    color: var(--text-main, #0f172a); font-size: 1rem; font-weight: 700;
    transition: transform .18s ease;
  }
  .q-box:not(.q-collapsed) .btm-step-toggle { transform: rotate(180deg); }
  .q-box.q-collapsed { padding-bottom: 0.75rem; }
}

/* ---------- Floating «Επόμενο βήμα» ---------- */
#btm-next {
  display: none;
  position: fixed; z-index: 71;
  right: 12px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  border-radius: 999px; border: 1px solid #1e293b;
  background: #0f172a; color: #f8fafc;
  font-size: 0.82rem; font-weight: 700; padding: 0.55rem 0.85rem;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.3); cursor: pointer;
}
@media (max-width: 900px) { #btm-next.btm-show { display: inline-flex; align-items: center; gap: .35rem; } }

/* ---------- Autosave ένδειξη ---------- */
#btm-autosave { font-size: 0.72rem; color: #94a3b8; font-weight: 600; white-space: nowrap; }
.btm-desktop-save { display: block; margin-top: 0.15rem; font-size: 0.72rem; color: var(--text-muted, #64748b); white-space: nowrap; }

/* ---------- Print: κρύψε τα νέα στοιχεία ---------- */
@media print {
  #btm-bar, #btm-next, .btm-desktop-new, .btm-step-toggle, #btm-autosave { display: none !important; }
}

/* ==========================================================
   Λειτουργία υπαλλήλου & Παρουσίασης
   ========================================================== */

/* --- Κουμπιά στο sidebar footer --- */
.btm-mode-box { margin-top: 0.65rem; display: grid; gap: 0.35rem; }
.btm-mode-btn {
  display: flex; align-items: center; gap: 0.45rem;
  width: 100%; min-height: 38px; padding: 0.4rem 0.6rem;
  border-radius: 9px; border: 1px solid #334155; background: #1e293b;
  color: #e2e8f0; font-size: 0.78rem; font-weight: 700; cursor: pointer; text-align: left;
}
.btm-mode-btn:hover { border-color: #475569; background: #273549; }
.btm-mode-btn.on { border-color: #059669; color: #34d399; }
.btm-mode-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; flex: 0 0 auto; }
.btm-mode-btn.on .dot { background: #34d399; }

/* --- ΛΕΙΤΟΥΡΓΙΑ ΥΠΑΛΛΗΛΟΥ: κρύψε προμήθειες/τιμολόγηση συνεργάτη --- */
body.btm-employee .commission-box,
body.btm-employee .partner-tier-card .tier-select-wrapper,
body.btm-employee #res-comm-rate,
body.btm-employee #saved-quotes-container [style*="#059669"],
body.btm-employee #saved-quotes-container [style*="color:#059669"] { display: none !important; }
body.btm-employee .btm-prof { display: none !important; }
body.btm-employee .btm-employee-badge { display: inline-flex !important; }

.btm-employee-badge {
  display: none;
  position: fixed; top: 10px; right: 10px; z-index: 95;
  background: #0f172a; color: #34d399; border: 1px solid #334155;
  border-radius: 999px; padding: 4px 10px; font-size: 0.7rem; font-weight: 800;
  letter-spacing: .04em; box-shadow: 0 8px 20px rgba(15,23,42,.25);
}
body.btm-employee .quick-stats .stat-chip:nth-child(2) { display: none !important; }

/* --- ΛΕΙΤΟΥΡΓΙΑ ΠΑΡΟΥΣΙΑΣΗΣ (για πελάτη) --- */
body.btm-present .sidebar,
body.btm-present .nav-backdrop,
body.btm-present .mobile-menu-btn,
body.btm-present .commission-box,
body.btm-present .btm-actions,
body.btm-present #btm-bar,
body.btm-present #btm-next,
body.btm-present .btm-desktop-new,
body.btm-present .partner-tier-card { display: none !important; }

body.btm-present .app-container { display: block; }
body.btm-present .main-wrapper { width: 100%; }
body.btm-present .top-bar {
  position: static; background: #fff; border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}
body.btm-present .content-body {
  max-width: 980px; margin: 0 auto; padding: 1.5rem 1.5rem 4rem;
}
body.btm-present .page-info h1 { font-size: 1.6rem; }
body.btm-present .q-title { font-size: 1.15rem; }
body.btm-present .q-desc { font-size: 0.95rem; }
body.btm-present .opt-title { font-size: 1rem; }
body.btm-present .opt-sub { font-size: 0.85rem; }
body.btm-present .result-card { position: static; box-shadow: 0 10px 30px rgba(15,23,42,.08); }
body.btm-present .options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.btm-present .q-box { padding: 1.5rem; }

.btm-present-exit {
  position: fixed; top: 12px; right: 12px; z-index: 120;
  display: none; align-items: center; gap: .4rem;
  background: #0f172a; color: #f8fafc; border: 1px solid #334155;
  border-radius: 999px; padding: .5rem .9rem; font-size: .8rem; font-weight: 700;
  cursor: pointer; box-shadow: 0 10px 26px rgba(15,23,42,.3);
}
body.btm-present .btm-present-exit { display: inline-flex; }

@media print {
  body.btm-present .btm-present-exit { display: none !important; }
}

/* Presentation: κρύψε και τα chips προμήθειας στο header/κάρτα */
body.btm-present .quick-stats .stat-chip:nth-child(2),
body.btm-present #res-comm-rate { display: none !important; }
body.btm-present .top-bar { padding-right: 190px; }

/* ==========================================================
   Header responsive fix (μεσαία πλάτη / split-screen)
   ========================================================== */
@media (max-width: 1200px) {
  .top-bar {
    flex-wrap: wrap !important;
    row-gap: 0.45rem;
    align-items: flex-start;
  }
  .page-info { flex: 1 1 100% !important; min-width: 0; }
  .page-info h1 { font-size: 1.18rem !important; line-height: 1.25; }
  .page-info p { font-size: 0.78rem; line-height: 1.35; }
  .quick-stats {
    flex: 1 1 100% !important;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-start;
  }
  .quick-stats .stat-chip { flex: 0 1 auto; white-space: nowrap; }
  .btm-desktop-new { margin-left: auto; }
}
@media (max-width: 720px) {
  .page-info h1 { font-size: 1.02rem !important; }
  .page-info p { display: none; }
  .quick-stats .stat-chip { font-size: 0.74rem; padding: 0.25rem 0.55rem; }
  .btm-desktop-new { font-size: 0.74rem; padding: 0.25rem 0.55rem; }
}
@media (max-width: 400px) {
  .quick-stats .stat-chip span { display: none; }
  .btm-desktop-new { display: none !important; }
}

/* ==========================================================
   Mobile polish: portrait + landscape (μικρό ύψος)
   ========================================================== */
@media (max-width: 900px) {
  /* Πιο compact header */
  .mobile-menu-btn { width: 40px; height: 40px; }
  .top-bar { padding: 0.45rem 0.7rem; }
  .page-info h1 { font-size: 1.02rem !important; }

  /* Sticky bar: 2 γραμμές αντί 3, μικρότερα κουμπιά */
  #btm-bar { padding: 0.4rem 0.6rem calc(0.4rem + env(safe-area-inset-bottom)); }
  #btm-bar .btm-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.45rem; }
  #btm-bar .btm-line1 { display: none; }
  #btm-bar .btm-line2 { font-size: 0.95rem; }
  #btm-bar .btm-line3 { font-size: 0.72rem; }
  #btm-bar .btm-btn { min-height: 36px; min-width: 36px; font-size: 0.74rem; }
  #btm-bar .btm-btn.primary { padding: 0 0.6rem; }
  .content-body { padding-bottom: 4.4rem !important; }

  /* FAB πάνω από τη bar, μικρότερο */
  #btm-next { bottom: calc(74px + env(safe-area-inset-bottom)); right: 10px; font-size: 0.74rem; padding: 0.45rem 0.7rem; }

  /* Πιο σφιχτά βήματα */
  .q-box { padding: 0.9rem !important; }
  .q-title { font-size: 1rem !important; }
  .q-desc { font-size: 0.82rem; }
  .opt-content { padding: 0.65rem 0.75rem !important; }
}

/* Landscape κινητού: μονή σειρά header + compact bar */
@media (max-height: 480px) and (orientation: landscape) {
  .top-bar {
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 0.3rem 0.6rem !important;
  }
  .page-info { flex: 1 1 auto !important; min-width: 0; }
  .page-info h1 {
    font-size: 0.95rem !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .page-info p { display: none !important; }
  .mobile-menu-btn { width: 34px; height: 34px; }
  .quick-stats { flex: 0 0 auto !important; flex-wrap: nowrap; }
  .quick-stats .stat-chip { font-size: 0.68rem; padding: 0.2rem 0.45rem; }
  .quick-stats .stat-chip span { display: none; }
  .btm-desktop-new { display: none !important; }

  .content-body { padding: 0.6rem 0.8rem 3.6rem !important; }
  #btm-bar { padding: 0.3rem 0.6rem calc(0.3rem + env(safe-area-inset-bottom)); }
  #btm-bar .btm-line2 { font-size: 0.88rem; }
  #btm-bar .btm-line3 { font-size: 0.68rem; }
  #btm-bar .btm-btn { min-height: 32px; min-width: 32px; font-size: 0.7rem; }
  #btm-next { display: none !important; }
  .q-box { padding: 0.7rem 0.8rem !important; }
  .q-title { font-size: 0.95rem !important; }
  .options-grid { gap: 0.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .opt-content { padding: 0.55rem 0.65rem !important; }
  .opt-sub { display: none; }
  .sidebar { width: min(280px, 80vw) !important; }
}
