/* Button Component Styles */

@property --btn-primary-highlight {
    syntax: '<number>';
    inherits: true;
    initial-value: 0.65;
}

@property --btn-primary-before-opacity {
    syntax: '<number>';
    inherits: true;
    initial-value: 0.2;
}

@property --btn-secondary-highlight {
    syntax: '<number>';
    inherits: true;
    initial-value: 0.65;
}

@property --btn-secondary-before-opacity {
    syntax: '<number>';
    inherits: true;
    initial-value: 0.2;
}

/* Base Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--button-padding);
    border-radius: var(--radius-button);
    font-family: var(--font-family-heading);
    font-size: var(--font-size-button);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-button);
    transition: background 0.7s ease-out, color 0.7s ease-out, box-shadow 0.7s ease-out, transform 0.7s ease-out;
    position: relative;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    font-variation-settings: var(--font-variation-settings);
    text-decoration: none;
    box-sizing: border-box;
    min-height: var(--button-height);
    z-index: var(--z-index-base);
}

.btn * {
    position: relative;
    z-index: 1;
}

.btn:hover {
    opacity: 1;
}

.btn:focus {
    outline: 2px solid rgba(var(--color-primary-rgb), 0.5);
    outline-offset: 2px;
}

/* Primary Button */
.btn-primary {
    --btn-primary-highlight: 0.65;
    --btn-primary-before-opacity: 0.2;
    background: linear-gradient(to right, rgba(255, 255, 255, var(--btn-primary-highlight)), #ffffff);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    transition: --btn-primary-highlight 0.7s ease-out, color 0.7s ease-out, box-shadow 0.7s ease-out;
}

.btn-primary::before {
    content: '';
    position: absolute;
    left: var(--button-before-offset);
    top: 0;
    width: var(--button-before-size);
    height: var(--button-before-size);
    background: rgba(255, 255, 255, var(--btn-primary-before-opacity));
    border-radius: var(--button-before-radius);
    z-index: -1;
    transition: left 0.7s ease-out, --btn-primary-before-opacity 0.3s ease-out;
}

/* Primary Button Hover */
.btn-primary:hover:not(:disabled),
.btn-primary.btn-hover {
    --btn-primary-highlight: 1;
    --btn-primary-before-opacity: 1;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled)::before,
.btn-primary.btn-hover::before {
    left: calc(100% - var(--button-before-size));
}

/* Primary Button Disabled */
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button */
.btn-secondary {
    --btn-secondary-highlight: 0.65;
    --btn-secondary-before-opacity: 0.2;
    background: linear-gradient(to right, rgba(var(--color-primary-rgb), var(--btn-secondary-highlight)), var(--color-primary));
    color: var(--color-text-light);
    box-shadow: 0 0 0 1px rgba(var(--color-primary-rgb), 0.2);
    transition: --btn-secondary-highlight 0.7s ease-out, color 0.7s ease-out, box-shadow 0.7s ease-out;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    left: var(--button-before-offset);
    top: 0;
    width: var(--button-before-size);
    height: var(--button-before-size);
    background: rgba(var(--color-primary-rgb), var(--btn-secondary-before-opacity));
    border-radius: var(--button-before-radius);
    z-index: -1;
    transition: left 0.7s ease-out, --btn-secondary-before-opacity 0.3s ease-out;
}

/* Secondary Button Hover */
.btn-secondary:hover:not(:disabled),
.btn-secondary.btn-hover {
    --btn-secondary-highlight: 1;
    --btn-secondary-before-opacity: 1;
    box-shadow: 0 0 0 1px rgba(var(--color-primary-rgb), 0.2);
}

.btn-secondary:hover:not(:disabled)::before,
.btn-secondary.btn-hover::before {
    left: calc(100% - var(--button-before-size));
}

/* Secondary Button Disabled */
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button Icons - White */
.btn-secondary .btn-icon-right-img,
.btn-secondary .btn-icon-left-img,
.btn-secondary .btn-icon-img {
    filter: brightness(0) invert(1);
}

/* Primary Button - Solid (No Gradient) */
.btn-primary.btn-solid {
    background: var(--color-text-light);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* Secondary Button - Solid (No Gradient) */
.btn-secondary.btn-solid {
    background: var(--color-primary);
    color: var(--color-text-light);
    box-shadow: 0 0 0 1px rgba(var(--color-primary-rgb), 0.2);
}

/* Button with Right Icon */
.btn-icon-right {
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 10px;
}

/* Button with Left Icon */
.btn-icon-left {
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 10px;
}

.btn-icon-right .btn-icon-right-img,
.btn-icon-left .btn-icon-left-img,
.btn-icon-only .btn-icon-img {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: var(--font-family-heading);
    font-size: 16px;
    line-height: 1;
}

.btn-icon-right .btn-icon-right-img::before,
.btn-icon-only .btn-icon-img::before {
    content: ">>";
}

.btn-icon-left .btn-icon-left-img::before {
    content: ">>";
}

/* Button with Both Icons (Left and Right) */
.btn-icon-left.btn-icon-right {
    padding-left: 12px;
    padding-right: 12px;
}

/* Icon Only Button */
.btn-icon-only {
    width: 48px;
    height: 48px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-only .btn-icon-img {
    /* Icon-only button uses the same textual arrow as other icon buttons */
}

/* Text Link */
.btn-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 28px;
    text-decoration: none;
    transition: all 0.3s ease-out;
    color: #717680;
}

.btn-text u {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: auto;
}

/* Text Link - Black */
.btn-text-black {
    color: #111111;
    opacity: 0.5;
}

.btn-text-black:hover,
.btn-text-black.btn-text-hover {
    opacity: 1;
}

/* Text Link - White */
.btn-text-white {
    color: #ffffff;
    opacity: 0.5;
}

.btn-text-white:hover,
.btn-text-white.btn-text-hover {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .btn {
        font-size: 14px;
        padding: 8px 16px;
        min-height: 44px;
    }
    
    .btn-primary::before,
    .btn-secondary::before {
        width: 44px;
        height: 44px;
        border-radius: 22px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .btn-icon-only {
        width: 44px;
        height: 44px;
        padding: 10px;
    }
    
    .btn-text {
        font-size: 16px;
    }
}
