/* ==========================================================================
   WC Tip & Donation — Widget Styles
   Works for both classic (shortcode) and block cart/checkout contexts.

   All colors use CSS variables so they can be overridden by the settings page
   (see WC_Tip_Shortcode::inline_styles). Fonts inherit from the site's
   primary font via `font-family: inherit`.
   ========================================================================== */

.wc-tip-donation-widget {
    --wc-tip-bg:            #fafafa;
    --wc-tip-border:        #e5e5e5;
    --wc-tip-heading:       #1a1a1a;
    --wc-tip-description:   #666666;
    --wc-tip-btn-bg:        #ffffff;
    --wc-tip-btn-fg:        #333333;
    --wc-tip-btn-border:    #cccccc;
    --wc-tip-active-bg:     #0071a1;
    --wc-tip-active-fg:     #ffffff;
    --wc-tip-active-border: #0071a1;
    --wc-tip-remove-fg:     #a00000;

    margin: 1.25em 0;
    padding: 1em 1.25em;
    background: var( --wc-tip-bg );
    border: 1px solid var( --wc-tip-border );
    border-radius: 6px;
    font-family: inherit;
}

/* Heading */
.wc-tip-label {
    margin: 0 0 .35em;
    font-weight: 600;
    font-size: 1em;
    font-family: inherit;
    color: var( --wc-tip-heading );
}

/* Optional description */
.wc-tip-description {
    margin: 0 0 .85em;
    font-size: .875em;
    font-family: inherit;
    color: var( --wc-tip-description );
    line-height: 1.5;
}

/* Amount buttons row */
.wc-tip-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: .5em;
    margin-bottom: .75em;
}

/* Individual amount button */
.wc-tip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: .45em .85em;
    border: 2px solid var( --wc-tip-btn-border );
    border-radius: 4px;
    background: var( --wc-tip-btn-bg );
    color: var( --wc-tip-btn-fg );
    font-family: inherit;
    font-size: .9em;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s, transform .1s;
    line-height: 1;
}

.wc-tip-btn:hover:not(:disabled) {
    border-color: var( --wc-tip-active-border );
    color: var( --wc-tip-active-border );
    transform: translateY( -1px );
}

.wc-tip-btn.is-active {
    border-color: var( --wc-tip-active-border );
    background: var( --wc-tip-active-bg );
    color: var( --wc-tip-active-fg );
}

.wc-tip-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* Remove button */
.wc-tip-remove {
    display: inline-block;
    padding: 0;
    border: none;
    background: transparent;
    color: var( --wc-tip-remove-fg );
    font-family: inherit;
    font-size: .8em;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.wc-tip-remove:hover {
    filter: brightness( 0.8 );
}

.wc-tip-remove:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ==========================================================================
   Loading overlay — shown over the cart/checkout totals area
   while the tip update request is in flight.
   ========================================================================== */

.wc-tip-loading-target {
    position: relative;
}

.wc-tip-loading-target.wc-tip-is-loading {
    pointer-events: none;
}

.wc-tip-loading-target.wc-tip-is-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba( 255, 255, 255, 0.7 );
    z-index: 99;
    border-radius: inherit;
    animation: wc-tip-fade-in .15s ease-out;
}

.wc-tip-loading-target.wc-tip-is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid rgba( 0, 113, 161, 0.2 );
    border-top-color: #0071a1;
    border-radius: 50%;
    animation: wc-tip-spin .8s linear infinite;
    z-index: 100;
}

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

@keyframes wc-tip-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
