/**
 * Design System - Button Components
 * 
 * Simplified button system with 3 sizes and automatic brand color adaptation.
 * Colors are blue on GTG, green on GTFI via CSS variables.
 * 
 * Usage:
 * <button class="btn">Default Button</button>
 * <button class="btn btn-sm">Small Button</button>
 * <button class="btn btn-lg">Large Button</button>
 * <button class="btn btn-blur">Blurred Background</button>
 */

/*------------------------------------*\
    BASE BUTTON
\*------------------------------------*/

.btn {
    /* Display & Layout */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    
    /* Sizing - Default (Medium) */
    padding: 1rem 1.5rem;
    min-height: 44px;
    
    /* Typography */
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: var(--font-bold);
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    white-space: nowrap;
    
    /* Colors - Uses brand color (blue for GTG, green for GTFI) */
    background: var(--color-brand);
    color: var(--color-white);
    border: none;
    
    /* Visual */
    border-radius: var(--radius-base);
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    
    /* Interaction */
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

/* Hover State */
.btn:hover:not(:disabled):not(.disabled) {
    background: var(--color-brand-dark);
    transform: scale(1.015);
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);
}

/* Active/Pressed State */
.btn:active:not(:disabled):not(.disabled) {
    transform: scale(0.98);
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
}

/* Focus State (Accessibility) */
.btn:focus {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

/* Disabled State */
.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}


/*------------------------------------*\
    SIZE VARIANTS
\*------------------------------------*/

/* Small Button */
.btn-sm,
.btn.btn-sm {
    padding: 0.625rem 1rem;
    min-height: 36px;
    font-size: 13px;
}

/* Large Button */
.btn-lg,
.btn.btn-lg {
    padding: 1.25rem 2rem;
    min-height: 52px;
    font-size: 16px;
}

/* Full Width */
.btn-block {
    width: 100%;
    display: flex;
}


/*------------------------------------*\
    STYLE VARIANTS
\*------------------------------------*/

/* Secondary/Outline Button */
.btn-secondary,
.btn.btn-secondary {
    background: transparent;
    color: var(--color-brand);
    border: 2px solid var(--color-brand);
    box-shadow: none;
}

.btn-secondary:hover:not(:disabled):not(.disabled),
.btn.btn-secondary:hover:not(:disabled):not(.disabled) {
    background: var(--color-brand);
    color: var(--color-white);
}

/* Ghost Button (subtle outline) */
.btn-ghost,
.btn.btn-ghost {
    background: transparent;
    color: var(--color-brand);
    border: 2px solid var(--color-brand-light);
    box-shadow: none;
}

.btn-ghost:hover:not(:disabled):not(.disabled),
.btn.btn-ghost:hover:not(:disabled):not(.disabled) {
    background: var(--color-brand-light);
    color: var(--color-white);
    border-color: var(--color-brand-light);
}

/* Blurred Background Button */
.btn-blur,
.btn.btn-blur {
    backdrop-filter: blur(10px);
    background-color: rgba(71, 199, 249, 0.7);
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-blur:hover:not(:disabled):not(.disabled),
.btn.btn-blur:hover:not(:disabled):not(.disabled) {
    background-color: rgba(71, 199, 249, 0.85);
}

/* Light/White Button */
.btn-light,
.btn.btn-light {
    background: var(--color-white);
    color: var(--color-brand);
    border: 2px solid var(--color-gray-300);
}

.btn-light:hover:not(:disabled):not(.disabled),
.btn.btn-light:hover:not(:disabled):not(.disabled) {
    background: var(--color-gray-100);
    border-color: var(--color-brand);
}

/* Danger/Delete Button */
.btn-danger,
.btn.btn-danger {
    background: var(--color-error);
}

.btn-danger:hover:not(:disabled):not(.disabled),
.btn.btn-danger:hover:not(:disabled):not(.disabled) {
    background: #d15678;
}


/*------------------------------------*\
    ICON SUPPORT
\*------------------------------------*/

.btn svg,
.btn i {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
}

.btn svg:only-child,
.btn i:only-child {
    margin: 0;
}


/*------------------------------------*\
    LOADING STATE
\*------------------------------------*/

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

.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 1em;
    height: 1em;
    border: 2px solid var(--color-white);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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


/*------------------------------------*\
    BACKWARD COMPATIBILITY
    All old button classes inherit from base .btn styles
\*------------------------------------*/

/* WooCommerce Buttons */
.woocommerce button.button,
.woocommerce a.button,
.woocommerce input.button,
.woocommerce-page button.button,
.woocommerce-page a.button,
.woocommerce-page input.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1.4em 3em;
    font-weight: var(--font-bold);
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-base);
    background: var(--color-brand) !important;
    color: var(--color-white) !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

.woocommerce button.button:hover:not(:disabled):not(.disabled),
.woocommerce a.button:hover:not(.disabled),
.woocommerce-page button.button:hover:not(:disabled):not(.disabled),
.woocommerce-page a.button:hover:not(.disabled) {
    background: var(--color-brand-dark) !important;
    transform: scale(1.015);
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);
}

.woocommerce button.button:active:not(:disabled):not(.disabled),
.woocommerce a.button:active:not(.disabled),
.woocommerce-page button.button:active:not(:disabled):not(.disabled),
.woocommerce-page a.button:active:not(.disabled) {
    transform: scale(0.98);
}

/* Cart Actions */
.shop_table tbody .actions button.button {
    padding: 1.4em 3em !important;
}

/* Gift Card Button */
button.button.ywgc_apply_gift_card_button {
    padding: 1em 2em;
    font-size: 16px !important;
}

/* Coupon Form Button */
.coupon-form button.button {
    padding: 1em 2em;
    font-size: 13px;
}

/* Continue Shopping Button */
.continue-shopping-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-base);
    background: var(--color-gray-200);
    color: var(--color-gray-900);
    font-weight: var(--font-semibold);
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

.continue-shopping-button:hover:not(:disabled):not(.disabled) {
    background: var(--color-gray-300);
    transform: scale(1.015);
}

/* White Border Button (Ghost variant) */
.white-border-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 32px;
    border: 2px solid var(--color-brand-light);
    border-radius: var(--radius-lg);
    background: var(--color-white);
    color: var(--color-brand);
    font-weight: var(--font-semibold);
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
}

.white-border-button:hover:not(:disabled):not(.disabled) {
    background: var(--color-brand-light);
    color: var(--color-white);
    transform: scale(1.015);
}

/* People Counter Buttons */
.people-button {
    height: 32px;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--color-gray-200);
    color: var(--color-gray-900);
    font-weight: var(--font-bold);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--color-gray-300);
}

.people-button:hover:not(.disabled-button) {
    background: var(--color-gray-300);
}

.people-button:active:not(.disabled-button) {
    transform: scale(0.95);
}

.people-button.disabled-button {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Search Button */
.search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-brand);
    color: var(--color-white);
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

.search-button:hover:not(:disabled):not(.disabled) {
    background: var(--color-brand-dark);
    transform: scale(1.015);
}

/* Homepage Filter Submit Button */
form.homepagefiltering div.formsubmit button {
    display: block;
    width: 100%;
    padding: 18px 40px;
    border-radius: var(--radius-base) !important;
    background: var(--color-brand) !important;
    color: var(--color-white) !important;
    font-weight: var(--font-bold);
    font-size: 14px;
    border: none;
    box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
    transition: all 0.2s ease;
    cursor: pointer;
}

form.homepagefiltering div.formsubmit button:hover:not(:disabled):not(.disabled) {
    background: var(--color-brand-dark) !important;
    transform: scale(1.015);
    box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
}

form.homepagefiltering div.formsubmit button:focus:not(:disabled):not(.disabled),
form.homepagefiltering div.formsubmit button:active:not(:disabled):not(.disabled) {
    transform: scale(0.97);
}

/* Mobile Booking Button */
.mobile-show-booking button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    background: var(--color-brand);
    color: var(--color-white);
    font-weight: var(--font-bold);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-show-booking button:hover:not(:disabled):not(.disabled) {
    background: var(--color-brand-dark);
    transform: scale(1.015);
}

/* Mobile Show Button (with blur) */
.mobile-show button {
    display: block;
    width: 100%;
    padding: 21px 40px;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    background-color: rgba(4, 165, 81, 0.7);
    font-size: 14px;
    font-weight: var(--font-bold);
    color: var(--color-white) !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
}

.mobile-show button:hover:not(:disabled):not(.disabled) {
    background-color: rgba(4, 165, 81, 0.85);
    transform: scale(1.015);
    box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.2);
}


/*------------------------------------*\
    RESPONSIVE OVERRIDES
\*------------------------------------*/

/* Tablet and up */
@media only screen and (min-width: 768px) {
    form.homepagefiltering div.formsubmit button {
        border-radius: 15px !important;
    }
}

/* Mobile */
@media only screen and (max-width: 769px) {
    /* Reduce button padding on mobile */
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 0.5rem 0.875rem;
        font-size: 12px;
    }
    
    .btn-lg {
        padding: 1rem 1.5rem;
        font-size: 15px;
    }
    
    form.homepagefiltering div.formsubmit button {
        border-radius: 0px 0px 20px 20px !important;
    }
}

@media only screen and (max-width: 768px) {
    form.homepagefiltering div.formsubmit button {
        border-radius: 20px !important;
    }
}
