/**
 * KB WhatsApp Orders & Chat Module
 * Frontend Styles
 *
 * @author Starter Labs
 * @copyright 2024 Starter Labs
 */

/* WhatsApp Order Button */
.kbwa-product-button-wrapper,
.kbwa-cart-button-wrapper {
    margin: 10px 0;
}

.kbwa-order-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background-color: #25D366;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.kbwa-order-button:hover,
.kbwa-order-button:focus {
    background-color: #1EBE5D;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.kbwa-order-button:active {
    transform: translateY(0);
}

.kbwa-order-button .kbwa-icon {
    margin-right: 8px;
    flex-shrink: 0;
}

.kbwa-order-button span {
    white-space: nowrap;
}

/* Cart Button Specific */
.kbwa-cart-button-wrapper .kbwa-order-button {
    margin-top: 15px;
}

/* Order Modal Styles */
#kbwaOrderModal .modal-header {
    border-bottom: none;
    padding: 20px;
}

#kbwaOrderModal .modal-title {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
}

#kbwaOrderModal .close {
    opacity: 1;
}

#kbwaOrderModal .close:hover {
    opacity: 0.8;
}

/* Multi-Step Form Styles */
.kbwa-multistep-form {
    padding: 0 20px 20px;
}

/* Progress Bar */
#kbwa-progressbar {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    counter-reset: step;
}

#kbwa-progressbar li {
    flex: 1;
    text-align: center;
    position: relative;
    padding-top: 45px;
}

#kbwa-progressbar li:before {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

#kbwa-progressbar li:first-child:before {
    left: 50%;
    width: 50%;
}

#kbwa-progressbar li:last-child:before {
    left: 0;
    width: 50%;
}

#kbwa-progressbar li .step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #e0e0e0;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 600;
    color: #999;
    z-index: 1;
    transition: all 0.3s ease;
}

#kbwa-progressbar li.active .step-number {
    background: #25D366;
    color: #fff;
}

#kbwa-progressbar li .step-title {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

#kbwa-progressbar li.active .step-title {
    color: #25D366;
    font-weight: 600;
}

/* Step Fieldsets */
.kbwa-step {
    border: none;
    padding: 0;
    margin: 0;
}

.kbwa-step-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #25D366;
    color: #333;
}

/* Form Elements */
.kbwa-multistep-form .form-group {
    margin-bottom: 20px;
}

.kbwa-multistep-form label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.kbwa-multistep-form .form-control {
    height: 45px;
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 10px 15px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kbwa-multistep-form .form-control:focus {
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
    outline: none;
}

.kbwa-multistep-form select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 8px 10px;
    padding-right: 35px;
}

/* Step Buttons */
.kbwa-step-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.kbwa-step-buttons .btn {
    min-width: 120px;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 4px;
}

.kbwa-prev-btn {
    background: #f5f5f5;
    border-color: #ddd;
    color: #666;
}

.kbwa-prev-btn:hover {
    background: #eee;
    border-color: #ccc;
    color: #333;
}

.kbwa-next-btn {
    background: #25D366;
    border-color: #25D366;
    color: #fff;
}

.kbwa-next-btn:hover {
    background: #1EBE5D;
    border-color: #1EBE5D;
    color: #fff;
}

#kbwa-submit-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Error Alert */
.kbwa-error {
    margin-bottom: 20px;
    border-radius: 4px;
}

/* Preview Cards (Step 3) */
.kbwa-preview-card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    height: 100%;
}

.kbwa-preview-card h5 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    color: #333;
}

.kbwa-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kbwa-preview-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.kbwa-preview-list li:last-child {
    border-bottom: none;
}

.kbwa-preview-list strong {
    color: #666;
    margin-right: 5px;
}

/* Single Step Form Styles */
.kbwa-single-form {
    padding: 0 20px 20px;
}

.kbwa-single-form .form-group {
    margin-bottom: 15px;
}

.kbwa-single-form .row {
    margin: 0 -10px;
}

.kbwa-single-form .row > div {
    padding: 0 10px;
}

/* Loading State */
.kbwa-loading {
    position: relative;
    pointer-events: none;
}

.kbwa-loading:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    z-index: 10;
}

.kbwa-loading:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #25D366;
    border-top-color: transparent;
    border-radius: 50%;
    animation: kbwa-spin 0.8s linear infinite;
    z-index: 11;
}

@keyframes kbwa-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Success State */
.kbwa-success-message {
    text-align: center;
    padding: 40px 20px;
}

.kbwa-success-message .kbwa-success-icon {
    width: 80px;
    height: 80px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.kbwa-success-message .kbwa-success-icon svg {
    width: 40px;
    height: 40px;
    fill: #fff;
}

.kbwa-success-message h4 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.kbwa-success-message p {
    color: #666;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    #kbwa-progressbar li .step-title {
        font-size: 10px;
    }

    .kbwa-step-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .kbwa-step-buttons .btn {
        width: 100%;
    }

    .kbwa-preview-card {
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    .kbwa-order-button {
        padding: 10px 15px;
        font-size: 13px;
    }

    #kbwaOrderModal .modal-dialog {
        margin: 10px;
    }
}
