/* WooCommerce Tip Jar
   Styled to match a plain checkout field/card look (white background,
   thin gray border by default, black border when selected) instead of a
   custom color scheme, so it blends with the rest of the checkout form.
   !important is used on the card/button colors because many themes apply
   a global dark/branded background to all <button> elements, which would
   otherwise override this box and make the text unreadable. */

.tip-jar-box {
    background: #ffffff !important;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    padding: 0;
    margin: 20px 0;
    max-width: 520px;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    position: relative;
    transition: opacity 0.2s ease;
    box-sizing: border-box;
    overflow: hidden;
}

.tip-jar-box * {
    box-sizing: border-box;
}

.tip-jar-box.tip-loading {
    opacity: 0.55;
    pointer-events: none;
}

.tip-jar-heading {
    margin: 0;
    padding: 18px 20px 4px;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a !important;
    line-height: 1.3;
}

/* Consent checkbox row */
.tip-jar-consent {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #ececec;
    cursor: pointer;
    font-size: 15px;
    color: #1a1a1a !important;
}

.tip-jar-consent input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 4px;
    border: 1.5px solid #b7b7b7;
    background: #ffffff !important;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
}

.tip-jar-consent input[type="checkbox"]:checked {
    background: #1a1a1a !important;
    border-color: #1a1a1a;
}

.tip-jar-consent input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.tip-jar-consent-text {
    line-height: 1.35;
    color: #1a1a1a !important;
}

.tip-jar-panel {
    background: #ffffff !important;
    padding: 16px 20px 20px;
}

/* Percentage / None cards — same visual language as the Shipping/Payment
   option boxes: white background, thin gray border, black border + bold
   text when selected. No custom colors, so it always matches the theme. */
.tip-jar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.tip-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 4px;
    border: 1.5px solid #d9d9d9 !important;
    border-radius: 8px;
    background: #ffffff !important;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 46px;
    min-width: 0;
    overflow: hidden;
    box-shadow: none !important;
}

.tip-card:hover {
    border-color: #1a1a1a !important;
}

.tip-card-pct {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a !important;
    white-space: nowrap;
}

.tip-card-amt {
    font-size: 11px;
    color: #6b6b6b !important;
    white-space: nowrap;
}

.tip-card.active {
    border-color: #1a1a1a !important;
    border-width: 2px;
    background: #ffffff !important;
}

.tip-card.active .tip-card-pct,
.tip-card.active .tip-card-amt {
    color: #1a1a1a !important;
}

.tip-card-none {
    justify-content: center;
}

/* Custom amount row */
.tip-jar-custom-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.tip-jar-stepper {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1.5px solid #d9d9d9;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff !important;
}

.tip-jar-stepper:focus-within {
    border-color: #1a1a1a;
}

.tip-jar-stepper input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    padding: 12px 10px;
    font-size: 15px;
    background: transparent !important;
    color: #1a1a1a !important;
}

.tip-jar-stepper input::-webkit-outer-spin-button,
.tip-jar-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tip-jar-stepper-btn {
    border: none !important;
    background: transparent !important;
    color: #444448 !important;
    width: 34px;
    height: 34px;
    margin: 0 4px;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    flex: 0 0 auto;
    box-shadow: none !important;
}

.tip-jar-stepper-btn:hover {
    background: #eeeeee !important;
}

#tip-jar-custom-apply {
    border: 1.5px solid #1a1a1a !important;
    background: #1a1a1a !important;
    color: #ffffff !important;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
    flex: 0 0 auto;
    box-shadow: none !important;
}

#tip-jar-custom-apply:hover {
    background: #333333 !important;
}

.tip-jar-status {
    margin-top: 12px;
    font-size: 13px;
    min-height: 18px;
}

.tip-success {
    color: #1a7f37 !important;
}

.tip-error {
    color: #d1242f !important;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .tip-jar-box {
        max-width: 100%;
        border-radius: 10px;
    }

    .tip-jar-heading {
        padding: 16px 16px 4px;
        font-size: 18px;
    }

    .tip-jar-consent {
        padding: 14px 16px;
        font-size: 14px;
    }

    .tip-jar-panel {
        padding: 14px 16px 18px;
    }

    .tip-jar-grid {
        gap: 6px;
    }

    .tip-card {
        min-height: 42px;
        padding: 8px 2px;
    }

    .tip-card-pct {
        font-size: 12px;
    }

    .tip-card-amt {
        font-size: 10px;
    }

    .tip-jar-custom-row {
        flex-wrap: wrap;
    }

    .tip-jar-stepper {
        flex: 1 1 100%;
    }

    #tip-jar-custom-apply {
        width: 100%;
    }
}

@media (max-width: 360px) {
    .tip-jar-grid {
        gap: 4px;
    }

    .tip-card {
        padding: 6px 2px;
        min-height: 38px;
    }

    .tip-card-pct {
        font-size: 11px;
    }

    .tip-card-amt {
        font-size: 9px;
    }
}
