/* ===========================================
   PRESENTATION PUBLIC CSS
   Stili specifici per il viewer pubblico
   =========================================== */

/* ===========================================
   SLIDE PUBBLICA
   =========================================== */
.public-mode .slide {
  width: 92vw;
  height: 92vh;
  background: linear-gradient(135deg, var(--bg-card) 40%, rgba(20, 24, 36, 0.35) 100%);
  border-radius: 32px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 50px 100px -20px rgba(0, 0, 0, 0.8), 0 0 80px -10px var(--glow-primary);
  backdrop-filter: blur(20px);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.public-mode .slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--primary-color) 20%, var(--accent-color) 50%, var(--secondary-color) 80%, transparent 100%);
  opacity: 0.6;
}

/* Wrapper per contenuto animato */
.public-mode .slide-content-animated {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Contenuto interno della view pubblica */
.public-mode .public-view-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ===========================================
   HEADER PUBBLICO
   =========================================== */
.public-mode .public-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  text-align: center;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.public-mode .slide-title-header {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 2rem 0 1rem 0;
  text-align: center;
  flex-shrink: 0;
}

.public-mode .slide-title {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.75rem 0;
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
  text-align: left;
  flex-shrink: 0;
}

/* ===========================================
   CONTENUTO SLIDE PUBBLICA
   =========================================== */
.public-mode .slide-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 1rem 0;
  gap: 2rem;
  flex-direction: row;
  align-items: stretch;
}

/* ===========================================
   IMMAGINE PUBBLICA
   =========================================== */
.public-mode .slide-image {
  flex: 0 0 50%;
  max-width: 50%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

  .public-mode .slide-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
  }

/* Layout immagine sopra */
.public-mode .slide-content-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem 0;
  gap: 1.5rem;
}

.public-mode .slide-image-top {
  width: 100%;
  max-height: 45vh;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  flex-shrink: 0;
}

.public-mode .slide-image-top::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.2) 100%);
  pointer-events: none;
}

.public-mode .slide-image-top img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.public-mode .slide-text-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
  min-height: 0;
}

/* ===========================================
   LAYOUT FULL-IMAGE
   =========================================== */
.public-mode .slide-content.layout-full-image {
  position: relative;
  padding: 0;
  overflow: hidden;
  flex: 1;
}

.public-mode .full-image-background {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.4);
  z-index: 0;
}

.public-mode .overlay-content {
  position: relative;
  z-index: 1;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  justify-content: center;
  height: 100%;
}

.public-mode .overlay-content .slide-effect,
.public-mode .overlay-content .slide-bullets {
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.public-mode .overlay-content .slide-bullets li::before {
  text-shadow: 0 0 20px var(--glow-primary);
}

/* ===========================================
   LAYOUT EFFECT-IMAGE
   =========================================== */
.public-mode .slide-content.layout-effect-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 2rem;
  flex: 1;
}

.public-mode .effect-image-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.public-mode .slide-image-large {
  width: 100%;
  max-width: 800px;
  border-radius: 24px;
  box-shadow: 0 30px 80px -10px rgba(0, 0, 0, 0.6), 0 0 50px rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.public-mode .slide-image-large img {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 24px;
}

.public-mode .slide-effect-prominent {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--accent-color);
  font-style: italic;
  padding: 1.5rem 2rem;
  border-left: 2px solid var(--accent-color);
  background: linear-gradient(90deg, rgba(236, 72, 153, 0.2) 0%, transparent 100%);
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(236, 72, 153, 0.15);
  line-height: 1.4;
  text-align: center;
  width: 100%;
  max-width: 800px;
}

/* Mobile adjustments for effect-image layout */
@media (max-width: 768px) {
  .public-mode .slide-content.layout-effect-image {
    gap: 1.5rem;
    padding: 1rem;
  }
  
  .public-mode .effect-image-container {
    gap: 1.5rem;
  }
  
  .public-mode .slide-image-large {
    max-width: 100%;
  }
  
  .public-mode .slide-image-large img {
    max-height: 50vh;
    border-radius: 16px;
  }
  
  .public-mode .slide-effect-prominent {
    font-size: 1.5rem;
    padding: 1rem 1.5rem;
    border-left-width: 4px;
  }
}

@media (max-width: 640px) {
  .public-mode .slide-image-large img {
    max-height: 45vh;
    border-radius: 12px;
  }
  
  .public-mode .slide-effect-prominent {
    font-size: 1.25rem;
    padding: 0.85rem 1.25rem;
  }
}

/* ===========================================
   TESTO PUBBLICO
   =========================================== */
.public-mode .slide-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.public-mode .slide-effect {
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--accent-color);
  font-style: italic;
  padding: 0.85rem 1rem 0.85rem 1.25rem;
  border-left: 4px solid var(--accent-color);
  background: linear-gradient(90deg, rgba(236, 72, 153, 0.15) 0%, transparent 100%);
  border-radius: 10px;
  box-shadow: 0 0 30px rgba(236, 72, 153, 0.1);
  line-height: 1.5;
  flex-shrink: 0;
}

.public-mode .slide-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.public-mode .slide-bullets li {
  font-size: 1.25rem;
  padding-left: 1.75rem;
  position: relative;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.public-mode .slide-bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: -9px;
  color: var(--primary-color);
  font-size: 2rem;
  text-shadow: 0 0 20px var(--glow-primary);
}

/* FIX: Prevent overlapping of nested HTML elements in bullets */
.public-mode .slide-bullets li p {
  margin: 0 !important;
  padding: 0 !important;
  display: inline;
}

.public-mode .slide-bullets li ul,
.public-mode .slide-bullets li ol {
  margin: 1rem 0 0 1.5rem !important;
  padding: 0 !important;
}

.public-mode .slide-bullets li ul li,
.public-mode .slide-bullets li ol li {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
}

.public-mode .slide-bullets li ul li::before {
  content: "•";
  font-size: 2rem;
  left: -10px;
  top: -15px;
}

.public.mode .slide-bullets li ol li {
  counter-increment: nested-counter;
  padding-left: 2rem;
}

.public-mode .slide-bullets li ol li::before {
  content: counter(nested-counter) ".";
  font-size: 1.4rem;
  font-weight: 700;
  left: -5px;
  top: -10px;
}

/* ===========================================
   FOOTER PUBBLICO
   =========================================== */
.public-mode .slide-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  min-height: 60px;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.public-mode .controls-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  order: 1;
}

.public-mode .controls-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  order: 3;
}

.public-mode .slide-counter {
  order: 2;
}

/* Indicatore Live */
.public-mode .live-indicator-center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(236, 72, 153, 0.15));
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 10px;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.5rem auto 0 auto;
  flex-shrink: 0;
}

.public-mode .live-indicator-center .mud-icon-root {
  font-size: 1.8rem;
  display: flex;
  align-items: center;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===========================================
   PULSANTI NAVIGAZIONE
   =========================================== */
.public-mode .nav-btn {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
  color: white !important;
  border: none !important;
  padding: 0.65rem 1.25rem !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  border-radius: 12px !important;
  cursor: pointer;
  transition: all 0.3s ease !important;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25) !important;
  text-transform: none !important;
}

.public-mode .nav-btn:hover:not(:disabled) {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4) !important;
}

.public-mode .nav-btn:disabled {
  opacity: 0.3 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.public-mode .slide-counter {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(99, 102, 241, 0.15);
  padding: 0.5rem 1rem;
  border-radius: 12px;
  min-width: 80px;
  text-align: center;
  flex-shrink: 0;
}

/* ===========================================
   PULSANTI EXTRA (VIDEO/HOME)
   =========================================== */
.public-mode .extra-nav-btn {
  background: transparent !important;
  border: 1.5px solid rgba(255, 107, 53, 0.4) !important;
  color: #ff6b35 !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  cursor: pointer;
  transition: all 0.3s ease !important;
  text-transform: none !important;
  min-width: auto !important;
  height: 42px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.public-mode .extra-nav-btn:hover {
  background: rgba(255, 107, 53, 0.1) !important;
  border-color: #ff6b35 !important;
  transform: translateY(-2px) !important;
}

.public-mode .extra-nav-btn .mud-icon-root {
  font-size: 1rem !important;
  display: flex;
  align-items: center;
}

.public-mode .extra-nav-btn .mud-button-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Responsive: nascondi testo su mobile */
@media (max-width: 768px) {
  .public-mode .slide-controls {
    padding: 0.75rem 0.5rem;
    min-height: auto;
    gap: 0.75rem;
    justify-content: center;
  }
  
  .public-mode .controls-left,
  .public-mode .controls-right {
    gap: 0.5rem;
  }
  
  .public-mode .nav-text {
    display: none;
  }
  
  .public-mode .extra-nav-text {
    display: none;
  }
  
  .public-mode .nav-btn {
    padding: 0.5rem !important;
    height: 38px !important;
    min-width: 38px !important;
  }
  
  .public-mode .extra-nav-btn {
    padding: 0.45rem !important;
    min-width: 38px !important;
    height: 38px !important;
  }
  
  .public-mode .slide-counter {
    min-width: 50px;
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
  }
}

/* ===========================================
   RESPONSIVE - MOBILE
   =========================================== */
@media (max-width: 768px) {
  .public-mode .slide {
    padding: 1.25rem 1rem;
    border-radius: 16px;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
  }

  .public-mode .public-title {
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
  }

  .public-mode .slide-title-header {
    font-size: 1.25rem;
    margin: 1rem 0 0.75rem 0;
  }

  .public-mode .slide-title {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    line-height: 1.25;
  }

  .public-mode .slide-content {
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    justify-content: flex-start;
  }

  .public-mode .slide-image {
    order: -1;
    flex: 0 0 auto;
    max-width: 100%;
    max-height: 28vh;
    border-radius: 12px;
  }

  .public-mode .slide-image img {
    object-fit: contain;
    object-position: center;
  }

  .public-mode .slide-text {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    gap: 1rem;
    justify-content: flex-start;
  }

  .public-mode .slide-effect {
    font-size: 1.1rem;
    padding: 0.75rem 1rem 0.75rem 1.15rem;
    line-height: 1.5;
  }

  .public-mode .slide-bullets {
    gap: 0.85rem;
  }

  .public-mode .slide-bullets li {
    font-size: 1.2rem;
    padding-left: 1.75rem;
    line-height: 1.5;
  }

  .public-mode .slide-bullets li::before {
    font-size: 1.3rem;
    left: 0;
    top: -3px;
  }

  .public-mode .slide-controls {
    padding-top: 0.75rem;
    min-height: 45px;
  }

  .public-mode .live-indicator-center {
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
  }
}

@media (max-width: 640px) {
  .public-mode .slide {
    padding: 1rem 0.75rem;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
  }

  .public-mode .slide-title {
    font-size: 1.25rem;
  }

  .public-mode .slide-image {
    max-height: 25vh;
  }
  
  .public-mode .slide-image img {
    object-fit: contain;
    object-position: center;
  }

  .public-mode .slide-effect {
    font-size: 1rem;
  }

  .public-mode .slide-bullets li {
    font-size: 1.1rem;
  }

  .public-mode .nav-btn .nav-text {
    display: none !important;
  }
}

/* ===========================================
   TEMA LIGHT - PUBLIC MODE
   =========================================== */
[data-theme="light"] .public-mode .slide {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .public-mode .slide::before {
  background: linear-gradient(90deg, transparent 0%, #ff6b35 20%, #ff8c42 50%, #f7931e 80%, transparent 100%);
}

[data-theme="light"] .public-mode .public-title {
  color: #64748b;
}

[data-theme="light"] .public-mode .slide-title-header {
  background: linear-gradient(135deg, #0f172a 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] .public-mode .slide-title {
  background: linear-gradient(135deg, #0f172a 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] .public-mode .slide-effect {
  color: #ff6b35;
  background: linear-gradient(90deg, rgba(255, 107, 53, 0.1) 0%, transparent 100%);
  border-left-color: #ff6b35;
}

[data-theme="light"] .public-mode .slide-bullets li {
  color: #0f172a;
}

[data-theme="light"] .public-mode .slide-bullets li::before {
  color: #ff6b35;
  text-shadow: none;
}

[data-theme="light"] .public-mode .slide-image {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.15), 0 0 40px rgba(255, 107, 53, 0.1);
}

[data-theme="light"] .public-mode .slide-image-top {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.15), 0 0 40px rgba(255, 107, 53, 0.1);
}

[data-theme="light"] .public-mode .slide-controls {
  border-top-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .public-mode .slide-counter {
  background: rgba(255, 107, 53, 0.1);
  border-color: rgba(255, 107, 53, 0.2);
  color: #475569;
}

/* ===========================================
   RESPONSIVE - MOBILE & TABLET (PUBLIC MODE ONLY)
   =========================================== */

/* Tablet portrait e mobile landscape */
@media (max-width: 1024px) {
  .public-mode .slide-content {
    flex-direction: column !important;
    gap: 1rem;
  }
  
  .public-mode .slide-image {
    flex: 0 0 auto;
    max-width: 100%;
    max-height: 40vh;
  }
  
  .public-mode .slide-title-header,
  .public-mode .slide-title {
    font-size: 1.25rem;
  }
  
  .public-mode .slide-effect {
    font-size: 0.95rem;
  }
  
  .public-mode .slide-bullets li {
    font-size: 0.9rem;
  }
}

/* Mobile portrait */
@media (max-width: 640px) {
  .public-mode .slide {
    width: 96vw;
    height: 96vh;
    padding: 0.75rem;
    border-radius: 24px;
  }
  
  .public-mode .slide-image {
    max-height: 25vh;
  }
  
  .public-mode .slide-image img {
    object-fit: contain;
    object-position: center;
  }
  
  .public-mode .slide-content-text p {
    font-size: 1rem
  }
  
  .public-mode .slide-title-header,
  .public-mode .slide-title {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem 0;
  }
  
  .public-mode .public-title {
    font-size: 0.75rem;
  }

  .public-mode .slide-effect {
    font-size: 1.25rem;
    padding: 0.5rem 0.75rem;
  }

  .public-mode .slide-bullets li {
    font-size: 1.1rem;
    padding-left: 1.25rem;
  }
  
  .public-mode .slide-counter {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
  }
}

/* Very small screens */
@media (max-width: 375px) {
  .public-mode .slide-image {
    max-height: 25vh;
  }
  
  .public-mode .slide-image img {
    object-fit: contain;
    object-position: center;
  }
  
  .public-mode .slide-title-header,
  .public-mode .slide-title {
    font-size: 1rem;
  }
}

/* Forza il slide-wrapper SOLO per landing e video */
.public-mode .slide-wrapper:has(.landing-slide),
.public-mode .slide-wrapper:has(.video-slide) {
  height: auto !important;
  min-height: 100vh !important;
  max-height: none !important;
  align-items: flex-start !important;
  overflow-y: auto !important;
}

/* Forza il presentation-container a permettere scroll SOLO per landing */
.presentation-container.public-mode:has(.landing-slide) {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: 100vh !important;
}

/* Video page: NO scroll forzato, contenuto centrato */
.presentation-container.public.mode.video-page {
  overflow: hidden !important;
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Forza il body e html SOLO per landing */
body:has(.landing-slide),
html:has(.landing-slide) {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: auto !important;
  min-height: 100vh !important;
}

/* Mobile: rimuovi tutti i constraint e forza scroll */
@media (max-width: 768px) {
  .public-mode .slide.landing-slide,
  .public-mode .slide.video-slide {
    width: 100vw !important;
    height: auto !important;
    min-height: 100vh !important;
    padding: 0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow-y: auto !important;
  }
  
  .public-mode .slide-wrapper:has(.landing-slide),
  .public-mode .slide-wrapper:has(.video-slide) {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    height: auto !important;
    min-height: 100vh !important;
  }
  
  /* Forza scroll su body per mobile landing */
  body:has(.landing-slide) {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    height: 100% !important;
  }
  
  html:has(.landing-slide) {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .presentation-container.public-mode:has(.landing-slide) {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}
