
/* ======================================================
   <!-- Stepper -->
/* ====================================================== */

.stepper-container {

    --stepper-color-default: #333;
    --stepper-color-active: white;
    --stepper-color-complete: #2563eb;
    --stepper-indicator-default: white;
    --stepper-indicator-active: #2563eb;
    --stepper-indicator-complete: #22c55e;
    --stepper-border-default: #ccc;
    --stepper-border-active: #2563eb;
    --stepper-border-complete: #22c55e;
    --stepper-line-default: #dfdfdf;
    --stepper-line-active: #2563eb;
    --stepper-line-complete: #22c55e;
    --stepper-indicator-font-size: 0.875rem;
    --stepper-indicator-offset: 60px;
    --stepper-title-size: 0.875rem;
    --stepper-indicator-size: 32px;
    


    position: relative;

    /* Navigation Header (only horizontal) */
    .stepper-header {
        display: flex;
        align-items: flex-start;
        flex-wrap: nowrap;
        position: relative;
        max-width: calc(100% - var(--stepper-indicator-size));

        /* background line */
        &::before {
            content: '';
            position: absolute;
            top: 16px;  /* Subtract the height of the title */
            left: 0;
            right: 0;
            height: 2px;
            background-color: var(--stepper-line-default);
            z-index: 1;
            width: 100%;
            
        }

        &::after {
            content: '';
            position: absolute;
            top: 16px; /* Subtract the height of the title */
            left: 0;
            height: 2px;
            background-color: var(--stepper-line-complete);
            z-index: 2;
            transition: width 0.3s ease-in-out;
            width: 0;
        }

        &::after {
            width: var(--stepper-progress-width, 0%);
            max-width: 100%;
        }
    }

    /* Main Navigation - Each step item (with circle + title) */
    .step-item {
        flex: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        max-width: 0;
        position: relative;
        z-index: 3;

        &.step-item--clickable {
            cursor: pointer;
        }
        
    }


    /* Line */
    .step-line {
        flex: 1;
        height: 2px;
        background-color:  var(--stepper-line-default);
        margin: 0 4px;
        position: relative;
        top: -10px;
        z-index: 0;
        overflow: hidden;
        opacity: 0;

        &--active {
            background-color: var(--stepper-line-default);
        }

        &--complete {
            background-color: var(--stepper-line-default);
        }
              
        &::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: var(--stepper-line-complete);
            transform: scaleX(0);
            transform-origin: left;
            transition: transform 0.3s ease-in-out;
        }   
        
        &--active::after,
        &--complete::after {
            transform: scaleX(1);
        }
    }



    /* Indicator */
    .step-indicator {
        width: var(--stepper-indicator-size);
        height: var(--stepper-indicator-size);
        margin: 0 auto 0.25rem;
        border-radius: 9999px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #ccc;
        font-size: var(--stepper-indicator-font-size);

        /* default */
        background-color: var(--stepper-indicator-default);
        color: var(--stepper-color-default);
        border-color: var(--stepper-border-default);

        &--active {
            background-color: var(--stepper-indicator-active);
            color: var(--stepper-color-active);
            border-color: var(--stepper-border-active);
        } 

        &--complete {
            background-color: var(--stepper-indicator-complete);
            color: var(--stepper-color-active);
            border-color: var(--stepper-border-complete);
        }

    }


    /* Title */
    .step-title {
        white-space: nowrap;
        font-size: var(--stepper-title-size);
        margin-left: calc(var(--stepper-indicator-offset) / 2);

        /* default */
        color: var(--stepper-color-default);

        &--active {
            color: var(--stepper-indicator-active);
        }

        &--complete {
            color: var(--stepper-indicator-complete);
        }
    }



    /* Panels Area */
    .stepper-panels {

    }

    /* Buttons */
    .stepper-buttons {
        display: flex;
        justify-content: space-between;
        margin-top: 1rem;
    }

    /* Panel */
    .stepper-panel {
        width: 100%;
    }
    .stepper-panel-header {
        font-size: 1.25rem;
        font-weight: bold;
        margin-bottom: 1rem;
        display: none;
    }
    .stepper-panel-content {
        width: 100%;
    }



}


/*------ Verticle ------*/
.stepper-container.stepper-container--vertical {


    display: flex;
    flex-direction: column;
    gap: 2.5rem; /* line length */
    max-height: calc(100% - var(--stepper-indicator-size));

    /* background line */
    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: calc(var(--stepper-indicator-size) / 2);
        width: 2px;
        height: 100%;
        background-color: var(--stepper-line-default);
        z-index: 1;
    }

    &::after {
        content: '';
        position: absolute;
        top: 0;
        left: calc(var(--stepper-indicator-size) / 2);
        width: 2px;
        background-color: var(--stepper-line-complete);
        z-index: 2;
        transition: height 0.3s ease-in-out;
        height: 0;
    }

    &::after {
        height: var(--stepper-progress-height, 0%);
        max-height: 100%;
    }


    /* Layout */
    .vertical-step-row {
        display: flex;
        align-items: flex-start;
    }
    .vertical-step-left {
        flex-shrink: 0;
        width: var(--stepper-indicator-size);
        height: var(--stepper-indicator-size);
        position: relative;
        
        /* Main Navigation - Each step item (with circle + title) */
        .step-item {
            margin-top: 0;
        }

        /* Line */
        .step-line {
            position: absolute;
            left: 20px;
            opacity: 0;
        }

    }
    
    .vertical-step-right {
        flex: 1;
        left: 70px;
        width: calc(100% - 70px);
        position: absolute;
        top: 0; /* required */
    }

    /* Title */
    .step-title {
        display: none;
        margin-left: .3rem;
    }
    
    /* Panel */
    .stepper-panel-header {
        display: block;
    }



    /* Line */
    .step-line {
        flex: auto;
        width: 2px;
        height: 40px;
        margin-top: 4px;
        top: auto;
        left: -24px;

        &::after {
            transform-origin: top;
            transform: scaleY(0);
        }   
        
        &--active::after,
        &--complete::after {
            transform: scaleY(1);
        }

    }
}