/**
 * Stepper (Wizard / Progress Steps)
 *
 * Componente de navegação por etapas/passos
 * Baseado nas especificações do Figma - Design System SIDASP
 *
 * @version 1.0.0
 * @date 2025-10-31
 */

/* ============================================================
   BASE STEPPER
   ============================================================ */

/**
 * Container principal do stepper
 */
.stepper {
    display: flex;
    flex-direction: row;
    width: 100%;
    position: relative;
}

/**
 * Lista de steps
 */
.stepper-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    list-style: none;
    padding: 0;
    margin: 0;
}

/**
 * Item individual (step)
 */
.stepper-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    position: relative;
    transition: all 0.3s ease;
}

.stepper-item:first-child {
    padding-top: 0;
}

.stepper-item:last-child {
    padding-bottom: 0;
}

/**
 * Linha conectora entre steps
 */
.stepper-item::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 52px;
    bottom: -16px;
    width: 2px;
    background: #E5E7EB;
    transition: background 0.3s ease;
}

.stepper-item:last-child::before {
    display: none;
}

/**
 * Ícone do step
 */
.stepper-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #E5E7EB;
    color: #8D95A8;
    font-size: 20px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.stepper-icon .material-icons {
    font-size: 20px;
}

/**
 * Conteúdo do step (título + descrição)
 */
.stepper-content {
    flex: 1;
    padding-top: 4px;
}

.stepper-title {
    font-size: 16px;
    font-weight: 600;
    color: #5A6478;
    margin: 0 0 4px 0;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.stepper-description {
    font-size: 14px;
    color: #8D95A8;
    margin: 0;
    line-height: 1.5;
    transition: color 0.3s ease;
}

/* ============================================================
   ESTADOS DO STEP
   ============================================================ */

/**
 * Step Ativo (atual)
 */
.stepper-item.active .stepper-icon {
    background: var(--color-accent-300);
    color: var(--color-text-light);
    box-shadow: 0 2px 8px rgba(63, 104, 251, 0.3);
}

.stepper-item.active .stepper-title {
    color: var(--color-neutral-800);
    font-weight: 600;
}

.stepper-item.active .stepper-description {
    color: #5A6478;
}

.stepper-item.active::before {
    background: #E5E7EB;
}

/**
 * Step Completo (concluído)
 */
.stepper-item.completed .stepper-icon {
    background: #47B881;
    color: var(--color-text-light);
}

.stepper-item.completed .stepper-title {
    color: var(--color-neutral-800);
}

.stepper-item.completed .stepper-description {
    color: #5A6478;
}

.stepper-item.completed::before {
    background: #47B881;
}

/**
 * Step com Erro
 */
.stepper-item.error .stepper-icon {
    background: #DC2626;
    color: var(--color-text-light);
}

.stepper-item.error .stepper-title {
    color: #DC2626;
}

.stepper-item.error .stepper-description {
    color: #DC2626;
}

.stepper-item.error::before {
    background: #DC2626;
}

/**
 * Step Desabilitado
 */
.stepper-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.stepper-item.disabled .stepper-icon {
    background: #F8F9FB;
    color: var(--color-neutral-400);
}

.stepper-item.disabled .stepper-title,
.stepper-item.disabled .stepper-description {
    color: var(--color-neutral-400);
}

/* ============================================================
   STEPPER CLICÁVEL
   ============================================================ */

.stepper-clickable .stepper-item {
    cursor: pointer;
}

.stepper-clickable .stepper-item:not(.disabled):hover .stepper-icon {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stepper-clickable .stepper-item:not(.disabled):hover .stepper-title {
    color: var(--color-accent-300);
}

.stepper-clickable .stepper-item:not(.disabled):active .stepper-icon {
    transform: scale(0.98);
}

/* ============================================================
   STEPPER HORIZONTAL
   ============================================================ */

.stepper-horizontal {
    flex-direction: row;
}

.stepper-horizontal .stepper-list {
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
}

.stepper-horizontal .stepper-item {
    flex: 1;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 16px;
    position: relative;
}

.stepper-horizontal .stepper-item::before {
    left: 50%;
    right: -50%;
    top: 20px;
    bottom: auto;
    width: calc(100% - 40px);
    height: 2px;
    transform: translateX(20px);
}

.stepper-horizontal .stepper-item:last-child::before {
    display: none;
}

.stepper-horizontal .stepper-content {
    padding-top: 12px;
}

.stepper-horizontal .stepper-title {
    text-align: center;
}

.stepper-horizontal .stepper-description {
    text-align: center;
}

/* ============================================================
   STEPPER COM NÚMEROS
   ============================================================ */

.stepper-numbered .stepper-icon {
    font-size: 16px;
    font-weight: 600;
}

/* ============================================================
   STEPPER SIZES
   ============================================================ */

.stepper-sm .stepper-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.stepper-sm .stepper-icon .material-icons {
    font-size: 16px;
}

.stepper-sm .stepper-title {
    font-size: 14px;
}

.stepper-sm .stepper-description {
    font-size: 12px;
}

.stepper-sm .stepper-item::before {
    left: 16px;
}

.stepper-lg .stepper-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
}

.stepper-lg .stepper-icon .material-icons {
    font-size: 24px;
}

.stepper-lg .stepper-title {
    font-size: 18px;
}

.stepper-lg .stepper-description {
    font-size: 16px;
}

.stepper-lg .stepper-item::before {
    left: 24px;
}

/* ============================================================
   STEPPER COMPACT (Sem descrição)
   ============================================================ */

.stepper-compact .stepper-description {
    display: none;
}

.stepper-compact .stepper-item {
    padding: 12px 0;
}

/* ============================================================
   STEPPER COM BADGE DE STATUS
   ============================================================ */

.stepper-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.stepper-badge-pending {
    background: #F8F9FB;
    color: #5A6478;
}

.stepper-badge-progress {
    background: #EEF3FF;
    color: var(--color-accent-300);
}

.stepper-badge-completed {
    background: #E8F5EE;
    color: #47B881;
}

.stepper-badge-error {
    background: #FEE2E2;
    color: #DC2626;
}

/* ============================================================
   STEPPER DARK MODE
   ============================================================ */

.stepper-dark,
.dark .stepper {
    color: #E5E7EB;
}

.stepper-dark .stepper-item::before,
.dark .stepper-item::before {
    background: var(--color-neutral-700);
}

.stepper-dark .stepper-icon,
.dark .stepper-icon {
    background: var(--color-neutral-700);
    color: #707896;
}

.stepper-dark .stepper-title,
.dark .stepper-title {
    color: var(--color-neutral-400);
}

.stepper-dark .stepper-description,
.dark .stepper-description {
    color: #707896;
}

.stepper-dark .stepper-item.active .stepper-title,
.dark .stepper-item.active .stepper-title {
    color: var(--color-text-light);
}

.stepper-dark .stepper-item.active .stepper-description,
.dark .stepper-item.active .stepper-description {
    color: var(--color-neutral-400);
}

.stepper-dark .stepper-item.completed .stepper-title,
.dark .stepper-item.completed .stepper-title {
    color: var(--color-text-light);
}

.stepper-dark .stepper-item.completed .stepper-description,
.dark .stepper-item.completed .stepper-description {
    color: var(--color-neutral-400);
}

.stepper-dark .stepper-item.disabled .stepper-icon,
.dark .stepper-item.disabled .stepper-icon {
    background: #1A1D29;
    color: #3E4354;
}

/* ============================================================
   STEPPER COM CARD
   ============================================================ */

.stepper-card {
    background: var(--color-text-light);
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
}

.stepper-dark.stepper-card,
.dark .stepper-card {
    background: #1A1D29;
    border-color: var(--color-neutral-700);
}

/* ============================================================
   STEPPER COM HEADER
   ============================================================ */

.stepper-header {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #E5E7EB;
}

.stepper-dark .stepper-header,
.dark .stepper-header {
    border-bottom-color: var(--color-neutral-700);
}

.stepper-header-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-neutral-800);
    margin: 0 0 4px 0;
}

.stepper-dark .stepper-header-title,
.dark .stepper-header-title {
    color: var(--color-text-light);
}

.stepper-header-subtitle {
    font-size: 14px;
    color: #5A6478;
    margin: 0;
}

.stepper-dark .stepper-header-subtitle,
.dark .stepper-header-subtitle {
    color: var(--color-neutral-400);
}

/* ============================================================
   STEPPER COM BOTÕES DE NAVEGAÇÃO
   ============================================================ */

.stepper-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    margin-top: 24px;
    border-top: 1px solid #E5E7EB;
}

.stepper-dark .stepper-navigation,
.dark .stepper-navigation {
    border-top-color: var(--color-neutral-700);
}

.stepper-nav-left {
    display: flex;
    gap: 12px;
}

.stepper-nav-right {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

/* ============================================================
   STEPPER PROGRESS BAR
   ============================================================ */

.stepper-progress {
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    margin-bottom: 24px;
    overflow: hidden;
}

.stepper-dark .stepper-progress,
.dark .stepper-progress {
    background: var(--color-neutral-700);
}

.stepper-progress-bar {
    height: 100%;
    background: var(--color-accent-300);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.stepper-progress-text {
    font-size: 14px;
    color: #5A6478;
    text-align: center;
    margin-bottom: 12px;
    font-weight: 500;
}

.stepper-dark .stepper-progress-text,
.dark .stepper-progress-text {
    color: var(--color-neutral-400);
}

/* ============================================================
   STEPPER COM ÍCONES CUSTOMIZADOS
   ============================================================ */

.stepper-item[data-icon]::after {
    content: attr(data-icon);
}

/* ============================================================
   ANIMAÇÕES
   ============================================================ */

@keyframes stepper-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stepper-animated .stepper-item {
    animation: stepper-fade-in 0.3s ease forwards;
}

.stepper-animated .stepper-item:nth-child(1) { animation-delay: 0s; }
.stepper-animated .stepper-item:nth-child(2) { animation-delay: 0.05s; }
.stepper-animated .stepper-item:nth-child(3) { animation-delay: 0.1s; }
.stepper-animated .stepper-item:nth-child(4) { animation-delay: 0.15s; }
.stepper-animated .stepper-item:nth-child(5) { animation-delay: 0.2s; }
.stepper-animated .stepper-item:nth-child(6) { animation-delay: 0.25s; }
.stepper-animated .stepper-item:nth-child(7) { animation-delay: 0.3s; }
.stepper-animated .stepper-item:nth-child(8) { animation-delay: 0.35s; }

/* ============================================================
   RESPONSIVO
   ============================================================ */

@media (max-width: 768px) {
    .stepper-horizontal {
        flex-direction: column;
    }

    .stepper-horizontal .stepper-list {
        flex-direction: column;
    }

    .stepper-horizontal .stepper-item {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        padding: 16px 0;
    }

    .stepper-horizontal .stepper-item::before {
        left: 20px;
        right: auto;
        top: 52px;
        bottom: -16px;
        width: 2px;
        height: auto;
        transform: none;
    }

    .stepper-horizontal .stepper-content {
        padding-top: 4px;
    }

    .stepper-horizontal .stepper-title,
    .stepper-horizontal .stepper-description {
        text-align: left;
    }

    .stepper-navigation {
        flex-direction: column;
    }

    .stepper-nav-left,
    .stepper-nav-right {
        width: 100%;
        flex-direction: column;
    }

    .stepper-nav-left button,
    .stepper-nav-right button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stepper-item {
        gap: 12px;
    }

    .stepper-icon {
        width: 36px;
        height: 36px;
    }

    .stepper-icon .material-icons {
        font-size: 18px;
    }

    .stepper-title {
        font-size: 15px;
    }

    .stepper-description {
        font-size: 13px;
    }

    .stepper-item::before {
        left: 18px;
    }
}

/* ============================================================
   ACESSIBILIDADE
   ============================================================ */

.stepper-item:focus {
    outline: 2px solid var(--color-accent-300);
    outline-offset: 2px;
    border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
    .stepper-item,
    .stepper-icon,
    .stepper-progress-bar {
        animation: none !important;
        transition: none !important;
    }
}

/* Screen reader only */
.stepper-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================================
   IMPRESSÃO
   ============================================================ */

@media print {
    .stepper-navigation {
        display: none;
    }

    .stepper-item::before {
        background: #000 !important;
    }
}
