/**
 * Mini Cart Coupon Field Styles
 * Styling for the coupon input field in the cart drawer
 */

/* Coupon Wrapper */
.hs-mini-cart-coupon-wrapper {
    padding: 15px 0 5px 0;
    border-top: 1px solid #eee;
    margin-top: 12px;
    margin-bottom: 0;
}

/* Coupon Form */
.hs-coupon-form {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.hs-coupon-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    text-align: right;
    direction: rtl;
}

.hs-coupon-input:focus {
    outline: none;
    border-color: #d4a853;
    box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.15);
}

.hs-coupon-input::placeholder {
    color: #999;
}

/* Apply Button */
.hs-coupon-button {
    padding: 10px 18px;
    background-color: #d4a853;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
}

.hs-coupon-button:hover:not(:disabled) {
    background-color: #c49643;
}

.hs-coupon-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Loading Spinner */
.hs-coupon-button .spinner-icon {
    animation: hs-spinner-rotate 1s linear infinite;
}

.hs-coupon-button .spinner-circle {
    stroke-dasharray: 50;
    stroke-dashoffset: 40;
}

@keyframes hs-spinner-rotate {
    100% {
        transform: rotate(360deg);
    }
}

/* Success/Error Messages */
.hs-coupon-message {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
}

.hs-message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.hs-message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Applied Coupons */
.hs-applied-coupons {
    margin-bottom: 10px;
}

.hs-applied-coupon {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    margin-bottom: 8px;
    direction: rtl;
}

.hs-coupon-success-icon {
    color: #28a745;
    font-weight: bold;
    font-size: 16px;
}

.hs-coupon-code-text {
    font-weight: 600;
    color: #155724;
    text-transform: uppercase;
}

.hs-coupon-discount {
    color: #155724;
    font-size: 13px;
    margin-right: auto;
}

.hs-remove-coupon {
    background: none;
    border: none;
    color: #721c24;
    font-size: 20px;
    line-height: 1;
    padding: 0 5px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.hs-remove-coupon:hover {
    opacity: 1;
}

/* Add Another Coupon Link */
.hs-add-another-coupon {
    text-align: center;
    margin-bottom: 5px;
}

.hs-add-coupon-link {
    background: none;
    border: none;
    color: #d4a853;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 5px 10px;
}

.hs-add-coupon-link:hover {
    color: #c49643;
}

/* Hidden Form (for adding another coupon) */
.hs-coupon-form-hidden {
    margin-top: 10px;
}

/* Coupon Discount Row in Totals */
.hs-mini-row.hs-coupon-discount-row {
    background-color: #e8f5e9;
    border-radius: 4px;
    padding: 8px 10px;
    margin: 5px 0;
}

.hs-mini-row.hs-coupon-discount-row span {
    color: #2e7d32;
}

.hs-mini-row.hs-coupon-discount-row strong {
    color: #2e7d32;
}

/* RTL Support */
[dir="rtl"] .hs-coupon-input,
.rtl .hs-coupon-input {
    text-align: right;
}

[dir="rtl"] .hs-applied-coupon,
.rtl .hs-applied-coupon {
    direction: rtl;
}

[dir="rtl"] .hs-coupon-discount,
.rtl .hs-coupon-discount {
    margin-right: auto;
    margin-left: 0;
}

/* Mobile Responsive */
@media screen and (max-width: 480px) {
    .hs-coupon-form {
        flex-direction: column;
    }

    .hs-coupon-button {
        width: 100%;
    }

    .hs-applied-coupon {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .hs-coupon-discount {
        margin-right: 0;
        width: 100%;
        margin-top: 5px;
    }
}

/* =========================================
   Checkout Coupon Custom Styles
   ========================================= */

/* Force Default Coupon Form to be blocked if accidentally rendered, 
   though PHP prevents this, CSS is double safety */
section.coupon-wrapper {
    display: none !important;
}

/* Force Coupon Form within our custom row to be visible */
.hs-coupon-row .woocommerce-form-coupon {
    display: block !important;
}

/* Hide "Have a coupon?" toggle text */
.hs-coupon-row .woocommerce-form-coupon-toggle {
    display: none !important;
}

/* Custom UI Container */
.hs-coupon-ui {
    display: flex;
    gap: 10px;
    padding: 12px;
    border: 1px dashed #c7a36b;
    border-radius: 8px;
    background: #fffaf3;
    align-items: center;
}

.hs-coupon-ui input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.hs-coupon-ui button {
    background: #c7a36b;
    color: #fff;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.3s;
}

.hs-coupon-ui button:hover {
    background: #b08d55;
}

/* Applied State */
.hs-coupon-success-row td {
    padding: 10px 0;
}

.hs-coupon-success {
    padding: 12px;
    background: #eaf8f0;
    border: 1px solid #4caf50;
    border-radius: 8px;
    color: #2e7d32;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    width: 100%;
}