/* WooCommerce Coupon Selector Styles - Artyf Digital Guidelines */

/* Global Font Definition (for modal and related elements) */
body, .wccs-modal-content, .wccs-open-modal, .wccs-coupon-action-button {
    font-family: 'Inter', sans-serif;
}

/* Modal Overlay */
#wccs-coupon-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Ensure it's on top of everything */
}

/* Modal Content Box - Secondary Color for Background, Black Text */
.wccs-modal-content {
    background-color: #E5E4E2; /* Secondary: #E5E4E2 */
    color: #000; /* Use black text over secondary */
    padding: 25px; /* Increased padding */
    border: none; /* No border needed with shadow */
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 16px 0 rgba(0,0,0,0.25), 0 12px 40px 0 rgba(0,0,0,0.15); /* Softer, more pronounced shadow */
    border-radius: 12px; /* More rounded corners */
    position: relative; /* Essential for loading overlay positioning */
    max-height: 85vh; /* Allow more height */
    overflow-y: auto; /* Enable scrolling for content */
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column; /* Stack content vertically */
}

/* Close Button */
.wccs-close-button {
    color: #333; /* Darker color for contrast */
    font-size: 32px; /* Larger for better touch target */
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

.wccs-close-button:hover,
.wccs-close-button:focus {
    color: #C90000; /* Primary color on hover */
    text-decoration: none;
}

/* Modal Header - Follows Primary Scheme */
.wccs-modal-content h2 {
    color: #C90000; /* Primary color for header text */
    text-align: center;
    margin-top: 0; /* Remove default top margin */
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #C90000; /* Highlight with primary color */
}

/* Coupon List Container */
.wccs-coupon-list-container {
    flex-grow: 1; /* Allows it to take available space and push button down */
    margin-top: 0; /* Adjusted due to h2 margin-bottom */
}

.wccs-coupon-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wccs-coupon-list li {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    justify-content: space-between;
    align-items: center;
    padding: 12px 0; /* More padding */
    border-bottom: 1px dashed #A9A9A9; /* Subtle dashed separator */
    font-size: 1em;
    gap: 10px; /* Space between elements */
}

.wccs-coupon-list li:last-child {
    border-bottom: none;
}

.wccs-coupon-code {
    font-weight: 600; /* Slightly bolder */
    color: #333; /* High contrast black */
    flex-basis: calc(70% - 15px); /* Take most width, leave space for button */
    word-break: break-word; /* Break long codes */
}

.wccs-coupon-description {
    font-size: 0.85em; /* Slightly smaller for description */
    color: #555; /* Slightly lighter black */
    flex-basis: 100%; /* Take full width below code */
    margin-top: 5px; /* Space above description */
}

/* Statuses */
.wccs-coupon-list li.wccs-applied .wccs-coupon-code {
    color: #008000; /* Green for applied (standard success color) */
}

.wccs-coupon-list li.wccs-invalid .wccs-coupon-code {
    color: #d9534f; /* Red for invalid (standard error color) */
    text-decoration: line-through;
}

/* Action Buttons - Primary Color Scheme */
/* Styling for the modal open button and action buttons within the modal */
.wccs-open-modal,
.wccs-coupon-action-button {
    background-color: #C90000; /* Primary: #C90000 */
    color: #fff; /* White text over primary */
    border: none;
    padding: 10px 20px; /* More padding */
    border-radius: 8px; /* Rounded corners */
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Soft shadow */
    text-decoration: none; /* For the anchor button */
    display: inline-flex; /* Align text and potentially icon */
    align-items: center;
    justify-content: center;
    /* Add margin to the button itself for spacing */
    margin-top: 20px; /* Default margin-top for spacing after other elements */
}

/* Force the red color with high specificity */
body .wccs-open-modal.button {
    background-color: #C90000 !important;
    color: #fff !important;
}

.wccs-open-modal:hover,
.wccs-coupon-action-button:hover:not(:disabled) {
    background-color: #a70000 !important; /* Subtle darker shade on hover */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important; /* Slightly larger shadow on hover */
    color: #fff !important; /* Ensure text remains white */
}

.wccs-coupon-action-button:disabled {
    background-color: #ccc !important; /* Disabled color */
    color: #666 !important; /* Disabled text color */
    cursor: not-allowed !important;
    opacity: 0.8 !important;
    box-shadow: none !important;
}

/* Rule to hide Elementor's default coupon box */
.e-coupon-box {
    display: none !important;
}


/* Loading message (within coupon list fetch) and error messages */
.wccs-loading-message,
.wccs-no-coupons,
.wccs-error-message {
    text-align: center;
    padding: 20px;
    color: #555; /* High contrast black */
    font-size: 0.95em;
}

.wccs-error-message {
    color: #d9534f; /* Error red */
    font-weight: 600;
}

/* --- Loading Overlay Styles --- */
.wccs-loading-overlay {
    position: absolute; /* Position relative to .wccs-modal-content */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(229, 228, 226, 0.9); /* Semi-transparent secondary color */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Above modal content */
    border-radius: 12px; /* Match modal content border-radius */
    color: #C90000; /* Primary color for text */
    font-size: 1.2em;
    font-weight: 600;
    text-align: center;
}

.wccs-spinner {
    border: 5px solid #f3f3f3; /* Light grey */
    border-top: 5px solid #C90000; /* Primary color spinner */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* --- End Loading Overlay Styles --- */

/* Styles for the new manual coupon input field */
.wccs-manual-coupon-input-item {
    border-bottom: 1px dashed #A9A9A9; /* Match other list items */
    padding-bottom: 15px; /* Add some spacing */
    margin-bottom: 15px; /* Add some spacing */
    display: flex; /* Use flex for layout */
    flex-direction: column; /* Stack input and button vertically on small screens */
    align-items: center; /* Center horizontally */
    gap: 10px; /* Space between input and button */
}

.wccs-manual-coupon-input-item .wccs-input-wrapper {
    display: flex;
    width: 100%; /* Take full width */
    gap: 10px; /* Space between input and button */
    justify-content: center;
    align-items: center; /* Ensures vertical alignment of flex items */
}

#wccs-manual-coupon-code {
    flex-grow: 1; /* Input takes available space */
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    height: 40px; /* Explicit height to match button roughly */
    line-height: 1; /* Match button's line-height for better alignment */
    vertical-align: middle; /* Added for extra safety, though flexbox should handle it */
}

#wccs-manual-apply-button {
    padding: 10px 15px; /* Adjust padding for better fit */
    font-size: 1em; /* Ensure consistency with input */
    min-width: 90px; /* Ensure button has minimum width, slightly less to fit better */
    height: 40px; /* Explicit height to match input */
    line-height: 1; /* Ensure text sits correctly within the button's explicit height */
    display: flex; /* Make it a flex container to center text */
    align-items: center; /* Center text vertically */
    justify-content: center; /* Center text horizontally */
    vertical-align: middle; /* Added for extra safety */
}


@media (max-width: 600px) {
    .wccs-modal-content {
        width: 95%;
        padding: 20px;
        border-radius: 10px;
    }
    .wccs-close-button {
        font-size: 24px;
        top: 8px;
        right: 12px;
    }
    .wccs-modal-content h2 {
        font-size: 1.4em;
    }
    .wccs-coupon-list li {
        flex-direction: column;
        align-items: flex-start;
    }
    .wccs-coupon-code, .wccs-coupon-description, .wccs-coupon-action-button {
        flex-basis: 100%;
        margin-left: 0;
        text-align: center;
    }
    .wccs-coupon-action-button {
        width: 100%;
        margin-top: 10px;
    }
    /* Adjust margin for button on small screens */
    .wccs-open-modal {
        margin-top: 15px; /* Adjust if needed for better spacing on mobile */
    }

    /* Manual input adjustments for mobile */
    .wccs-manual-coupon-input-item .wccs-input-wrapper {
        flex-direction: column; /* Stack input and button vertically on mobile */
        align-items: center;
    }
    #wccs-manual-coupon-code {
        max-width: 100%; /* Take full width on mobile */
        width: 100%;
    }
    #wccs-manual-apply-button {
        width: 100%; /* Button also takes full width */
    }
}
