/* ==========================================================================
   FINOX BUTTON DESIGN SYSTEM
   "Precision in Every Click"
   ========================================================================== */

/* Base Button Structure */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--btn-height);
    padding: 0 var(--btn-padding-x);
    border-radius: var(--btn-radius);
    font-family: var(--font-heading);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    line-height: 1;
    letter-spacing: 0.1px;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    z-index: 1;
    /* 3D precision edge highlight */
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15);
    transition: box-shadow 0.3s ease, color 0.3s ease, transform 0.15s ease, border-color 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Base Pseudo-elements for Premium Clip-Path Wipe */
.btn::before,
.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    /* Slanted start shape (invisible at left edge) */
    clip-path: polygon(0 0, 0 0, -30% 100%, 0 100%);
}

/* ::after acts as the fast accent "laser" blade */
.btn::after {
    transition: clip-path 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ::before acts as the main solid color fill */
.btn::before {
    transition: clip-path 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: -1;
}

/* Hover States: Sweeps the polygon across the button */
.btn:hover::before,
.btn:hover::after {
    clip-path: polygon(0 0, 130% 0, 100% 100%, 0 100%);
}

/* Ensure text and icons stay above animation layers */
.btn>span,
.btn>i,
.btn>svg {
    position: relative;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease;
    font-size: 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.8;
}

/* Interaction States */
.btn:active {
    transform: scale(0.985);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(32, 110, 247, 0.20);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================================
   BUTTON VARIANTS
   ========================================================================== */

/* Primary Button */
.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
    /* border: 1px solid var(--color-primary); */
}

.btn-primary::after {
    background-color: rgba(255, 255, 255, 0.25);
}

.btn-primary::before {
    background-color: var(--color-navy);
}

.btn-primary:hover {
    color: var(--color-white);
    /* border-color: var(--color-navy); */
    /* box-shadow: 0 8px 22px rgba(32, 110, 247, 0.16); */
}

/* Secondary Button */
.btn-secondary {
    background-color: transparent !important;
    color: var(--color-white);
    border: 1px solid var(--color-white);
}

.btn-secondary::after {
    background-color: var(--color-steel-blue);
}

.btn-secondary::before {
    background-color: var(--color-primary);
}

.btn-secondary:hover {
    color: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: 0 8px 22px rgba(35, 40, 54, 0.14);
}

/* Outline Button */
.btn-outline {
    background-color: transparent;
    color: var(--color-white);
    border: 1px solid var(--color-primary);
}

.btn-outline::after {
    background-color: var(--color-primary);
}

.btn-outline::before {
    background-color: var(--color-primary);
}

.btn-outline:hover {
    color: var(--color-white) !important;
    border-color: var(--color-primary);
    box-shadow: 0 8px 22px rgba(35, 40, 54, 0.14);
}

/* Light Button (for dark backgrounds) */
.btn-light {
    background-color: var(--color-white);
    color: var(--color-navy);
    border: 1px solid var(--color-white);
}

.btn-light::after {
    background-color: var(--color-navy);
}

.btn-light::before {
    background-color: var(--color-primary);
}

.btn-light:hover {
    color: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: 0 8px 22px rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   ICON BUTTONS & ANIMATIONS
   ========================================================================== */

.btn-icon {
    gap: 10px;
}

.btn-icon i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Subtle Icon Translation on Hover */
.btn:hover i.bi-arrow-right,
.btn:hover i.bi-chevron-right {
    transform: translateX(4px);
}

.btn:hover i.bi-box-arrow-up-right {
    transform: translate(2px, -2px);
}

.btn:hover i.bi-download,
.btn:hover i.bi-file-earmark-arrow-down,
.btn:hover i.bi-file-earmark-pdf {
    transform: translateY(3px);
}

/* Subtle Scale for phone/mail icons in buttons */
.btn:hover i.bi-telephone-fill,
.btn:hover i.bi-envelope-fill {
    transform: scale(1.08);
}

/* ==========================================================================
   BUTTON GROUP & RESPONSIVENESS
   ========================================================================== */

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

@media (max-width: 414px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    .btn-group .btn {
        width: 100%;
    }
}

/* ==========================================================================
   LOADING STATE
   ========================================================================== */

.btn-loading {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    margin-top: -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
    z-index: 3;
}

.btn-outline.btn-loading::after,
.btn-light.btn-loading::after {
    border: 2px solid rgba(35, 40, 54, 0.1);
    border-top-color: var(--color-navy);
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .btn {
        transition: none;
    }

    .btn::before {
        display: none;
    }

    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-outline:hover,
    .btn-light:hover {
        transform: none;
        box-shadow: none;
    }

    .btn-primary:hover {
        background-color: var(--color-navy);
    }

    .btn-secondary:hover {
        background-color: var(--color-primary);
    }

    .btn-outline:hover {
        background-color: var(--color-navy);
        color: var(--color-white);
    }

    .btn-light:hover {
        background-color: var(--color-primary);
        color: var(--color-white);
    }

    .btn:hover i {
        transform: none !important;
    }
}