/**
 * ==========================================================================
 * GEC Frontend Framework
 * ==========================================================================
 *
 * File        : switch.css
 * Version     : 2.1.0
 * Status      : Production
 *
 * Description :
 * Switch Component
 *
 * Dependencies:
 * - variables.css
 * - form-control.css
 *
 * ==========================================================================
 */


/* ==========================================================================
   01. WRAPPER
   ========================================================================== */

.gec-switch{

    display:inline-flex;

    align-items:center;

    gap:var(--space-3);

    cursor:pointer;

    user-select:none;

}


/* ==========================================================================
   02. INPUT
   ========================================================================== */

.gec-switch input[type="checkbox"]{

    position:relative;

    appearance:none;

    -webkit-appearance:none;

    flex-shrink:0;

    width:var(--switch-width);

    height:var(--switch-height);

    margin:0;

    border:

        var(--border-width)

        var(--border-style)

        var(--form-border-color);

    border-radius:var(--radius-full);

    background:var(--color-neutral-300);

    cursor:pointer;

    transition:

        background-color var(--transition-base),

        border-color var(--transition-base),

        box-shadow var(--transition-base);

}


/* ==========================================================================
   03. THUMB
   ========================================================================== */

.gec-switch input[type="checkbox"]::before{

    content:"";

    position:absolute;

    top:50%;

    left:2px;

    width:calc(var(--switch-height) - 6px);

    height:calc(var(--switch-height) - 6px);

    border-radius:50%;

    background:var(--color-white);

    transform:translateY(-50%);

    transition:transform var(--transition-base);

}


/* ==========================================================================
   04. CHECKED
   ========================================================================== */

.gec-switch input[type="checkbox"]:checked{

    background:var(--color-primary-500);

    border-color:var(--color-primary-500);

}

.gec-switch input[type="checkbox"]:checked::before{

    transform:

        translateY(-50%)

        translateX(

            calc(

                var(--switch-width)

                -

                var(--switch-height)

            )

        );

}


/* ==========================================================================
   05. HOVER
   ========================================================================== */

.gec-switch input[type="checkbox"]:hover{

    border-color:var(--color-primary-500);

}


/* ==========================================================================
   06. FOCUS
   ========================================================================== */

.gec-switch input[type="checkbox"]:focus-visible{

    outline:none;

    box-shadow:var(--focus-ring);

}


/* ==========================================================================
   07. DISABLED
   ========================================================================== */

.gec-switch input[type="checkbox"]:disabled{

    opacity:var(--opacity-disabled);

    cursor:not-allowed;

}

.gec-switch:has(input:disabled){

    cursor:not-allowed;

}


/* ==========================================================================
   08. LABEL
   ========================================================================== */

.gec-switch-label{

    line-height:var(--line-height-body);

    color:var(--color-text-primary);

}


/* ==========================================================================
   END OF FILE
   ========================================================================== */