/**
 * story-mode.css
 * Estilos para visualização Instagram Stories (9:16 - 1080x1920px)
 */

/* Modal Overlay */
.story-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.story-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  cursor: pointer;
}

/* Container Principal */
.story-container {
  position: relative;
  width: min(100vw, 540px);
  height: min(100vh, 960px);
  max-width: 540px;
  max-height: 960px;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

/* Navegação */
.story-nav {
  position: absolute;
  bottom: -70px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all 0.3s ease;
  z-index: 10002;
}

.story-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.story-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.story-nav-prev {
  left: 30%;
}

.story-nav-next {
  right: 30%;
}

/* Conteúdo do Story */
.story-content {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.story-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--spacing-2xl);
  color: white;
  position: relative;
  overflow: hidden;
}

/* Header do Story */
.story-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
}

.story-milestone-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius-lg);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-md);
}

.story-milestone-icon {
  font-size: var(--font-size-xl);
}

.story-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

/* Conteúdo Principal */
.story-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-lg);
  text-align: center;
  z-index: 2;
  position: relative;
}

/* Círculo de Progresso */
.story-progress-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.3;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.3));
}

/* Número de Dias */
.story-days-container {
  position: relative;
  z-index: 3;
}

.story-days-number {
  font-size: 8rem;
  font-weight: var(--font-weight-bold);
  line-height: 1;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  margin-bottom: var(--spacing-sm);
}

.story-days-label {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.95;
}

/* Nome do Hábito */
.story-habit-name {
  font-size: 2rem;
  font-weight: var(--font-weight-bold);
  margin-top: var(--spacing-lg);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
  max-width: 80%;
  word-wrap: break-word;
}

.story-date {
  font-size: var(--font-size-lg);
  opacity: 0.9;
  margin-top: var(--spacing-xs);
}

/* Próximo Marco */
.story-next-milestone {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius-lg);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.story-next-label {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
  margin-bottom: var(--spacing-sm);
}

.story-next-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-xs);
}

.story-next-icon {
  font-size: 2rem;
}

.story-next-days {
  font-size: var(--font-size-md);
  opacity: 0.9;
}

/* Marco Máximo */
.story-max-milestone {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius-lg);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.story-trophy {
  font-size: 4rem;
  margin-bottom: var(--spacing-sm);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.story-max-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

/* Footer do Story */
.story-footer {
  display: flex;
  justify-content: center;
  z-index: 2;
}

.story-branding {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius-lg);
}

.story-app-icon {
  font-size: var(--font-size-xl);
  flex-shrink: 0;
}

.story-branding-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.story-app-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

.story-app-url {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  opacity: 0.9;
  letter-spacing: 0.3px;
}

/* Barra de Ações Lateral */
.story-actions {
  position: absolute;
  right: -80px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  z-index: 10003;
}

.story-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.story-action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.story-action-btn svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* Barra de controles mobile (oculta no desktop) */
.story-controls-bar {
  display: none;
}

/* Animações */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsividade Mobile */
@media (max-width: 768px) {
  /* Ocultar controles do desktop */
  .story-nav,
  .story-actions {
    display: none !important;
  }

  /* Container vira coluna: [card] + [barra de controles] */
  .story-container {
    width: 100vw;
    height: auto;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  /* Card: proporção 9:16, nunca ultrapassa o espaço disponível */
  .story-content {
    width: 100%;
    aspect-ratio: 9 / 16;
    height: auto;
    max-height: calc(100dvh - 72px - env(safe-area-inset-bottom, 0px));
    max-width: calc((100dvh - 72px - env(safe-area-inset-bottom, 0px)) * 9 / 16);
    border-radius: 0;
    flex-shrink: 1;
  }

  /* Barra de controles mobile */
  .story-controls-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    height: 72px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
  }

  .story-controls-bar .story-action-btn {
    width: 48px;
    height: 48px;
    padding: var(--spacing-sm);
  }

  .story-controls-bar .story-action-btn svg {
    width: 22px;
    height: 22px;
  }

  .story-card {
    padding: var(--spacing-xl);
  }

  .story-days-number {
    font-size: 6rem;
  }

  .story-habit-name {
    font-size: 1.75rem;
  }
}

@media (max-width: 480px) {
  .story-content {
    max-height: calc(100dvh - 64px - env(safe-area-inset-bottom, 0px));
    max-width: calc((100dvh - 64px - env(safe-area-inset-bottom, 0px)) * 9 / 16);
  }

  .story-controls-bar {
    height: 64px;
  }

  .story-controls-bar .story-action-btn {
    width: 44px;
    height: 44px;
  }

  .story-controls-bar .story-action-btn svg {
    width: 20px;
    height: 20px;
  }

  .story-card {
    padding: var(--spacing-lg);
  }

  .story-days-number {
    font-size: 5rem;
  }

  .story-habit-name {
    font-size: 1.5rem;
  }
}

/* Print */
@media print {
  .story-modal {
    display: none !important;
  }
}
