/* Add styles for the checkout page and modal */

/* Checkout Page Layout */
#checkout {
    padding: 60px 0;
    background-color: #f8fafc;
}

.checkout-header {
    text-align: center;
    margin-bottom: 40px;
}

.checkout-header h1 {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.checkout-header p {
    color: var(--text-color);
    font-size: 18px;
    margin-bottom: 30px;
}

/* Checkout Steps */
.checkout-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 8px;
}

.step.active .step-number {
    background-color: var(--primary-color);
    color: var(--white);
}

.step-text {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
}

.step.active .step-text {
    color: var(--primary-color);
    font-weight: 600;
}

.step-connector {
    height: 3px;
    width: 80px;
    background-color: #e2e8f0;
    margin: 0 15px;
    margin-bottom: 30px;
}

/* Checkout Container */
.checkout-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.checkout-form-container {
    flex: 1 1 500px;
}

.checkout-form {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.checkout-form h3 {
    margin-bottom: 30px;
    color: var(--dark-color);
    font-size: 24px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h4 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--dark-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
    outline: none;
}

/* Payment Options */
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.payment-option {
    display: flex;
    align-items: center;
    padding: 18px;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
}

.payment-option:hover {
    transform: translateY(-2px);
    border-color: #cbd5e0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.payment-option.active {
    border-color: var(--primary-color);
    background-color: rgba(66, 153, 225, 0.05);
}

.payment-option.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background-color: var(--primary-color);
}

.payment-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.payment-logo {
    width: 56px;
    height: 56px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 15px;
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 8px;
    transition: all 0.3s ease;
}

.payment-logo img, .payment-logo i {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.payment-logo i {
    font-size: 24px;
    color: #64748b;
}

.payment-info {
    flex: 1;
}

.payment-info h4 {
    font-size: 17px;
    margin: 0 0 5px;
    color: var(--dark-color);
    transition: all 0.3s ease;
    font-weight: 600;
}

.payment-info p {
    font-size: 14px;
    color: var(--text-color);
    margin: 0;
}

.payment-option:hover .payment-info h4 {
    color: var(--primary-color);
}

.payment-check {
    color: var(--primary-color);
    font-size: 22px;
    opacity: 0;
    transition: all 0.3s ease;
}

.payment-option.active .payment-check {
    opacity: 1;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Form Terms */
.form-terms {
    margin-bottom: 20px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
}

.checkbox-wrapper input {
    margin-right: 10px;
}

.checkbox-wrapper label {
    font-size: 14px;
    color: var(--text-color);
}

.checkbox-wrapper a {
    color: var(--primary-color);
    text-decoration: none;
}

.checkbox-wrapper a:hover {
    text-decoration: underline;
}

/* Secure Payment */
.secure-payment {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f9ff;
    padding: 14px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    color: #2d3748;
    font-size: 14px;
    border: 1px solid #e0f2fe;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.secure-payment:hover {
    background-color: #e0f2fe;
    box-shadow: 0 3px 8px rgba(0,0,0,0.05);
}

.secure-payment i {
    margin-right: 10px;
    color: #0284c7;
    font-size: 16px;
}

/* Form Buttons */
.form-buttons {
    margin-top: 30px;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: 600;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    background-color: #2b6cb0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.2);
}

/* Order Summary */
.order-summary {
    flex: 1 1 350px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.order-card, .reviews-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.order-card h3, .reviews-card h4 {
    margin-bottom: 20px;
    color: var(--dark-color);
    font-size: 20px;
}

.product-selected {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.product-image {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), #2c5282);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 18px;
    color: var(--white);
    font-size: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.product-image i {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.product-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.product-details h4 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--dark-color);
}

.product-details p {
    margin: 0;
    font-size: 14px;
    color: var(--text-color);
}

.product-features-container {
    margin-bottom: 20px;
}

.product-features-container h5 {
    font-size: 16px;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.product-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-features li {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-color);
}

.product-features li i {
    margin-right: 10px;
    color: #10b981;
    font-size: 14px;
}

.divider {
    height: 1px;
    background-color: #e2e8f0;
    margin: 20px 0;
}

.price-summary {
    margin-top: 20px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-color);
}

.price-row.total {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-color);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

/* Reviews Section */
.reviews-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.reviews-header h4 {
    margin: 0;
}

.reviews-header h4 i {
    color: #eab308;
}

.reviews-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-color);
}

.rating-average {
    font-weight: 700;
    color: var(--dark-color);
}

.rating-average span {
    font-size: 16px;
    color: #eab308;
}

.reviews-list {
    max-height: 300px;
    overflow-y: auto;
}

.review-item {
    padding: 15px 0;
    border-bottom: 1px solid #e2e8f0;
}

.review-item:last-child {
    border-bottom: none;
}

.review-stars {
    margin-bottom: 8px;
    color: #eab308;
    font-size: 14px;
}

.review-text {
    font-size: 14px;
    color: var(--text-color);
    margin: 0 0 8px;
    font-style: italic;
}

.review-author {
    font-size: 12px;
    color: #64748b;
    text-align: right;
}

/* General Modal Enhancements */
.modal-content {
    max-width: 450px; /* Slightly narrower modal */
    border-radius: 12px;
    overflow: hidden;
}

.modal-header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--white);
    font-weight: 600;
    margin: 0;
    font-size: 20px;
}

.close-modal {
    color: rgba(255, 255, 255, 0.8);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-modal:hover {
    color: var(--white);
}

.modal-body {
    padding: 35px 30px;
    max-height: 500px; /* Limit height for better scrolling */
    overflow-y: auto;
}

/* Payment Processing */
#payment-processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.loader {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    position: relative;
    animation: pulse-ring 1.25s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.loader::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

@keyframes pulse-ring {
    0% { transform: scale(0.95); opacity: 1; }
    50% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(0.95); opacity: 1; }
}

#payment-processing p {
    font-size: 18px;
    font-weight: 500;
    color: var(--dark-color);
    text-align: center;
    max-width: 280px;
    line-height: 1.5;
    animation: fadeIn 1s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Payment QR Section */
#payment-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* Adjust spacing */
}

.binance-pay-brand {
    margin-bottom: 10px;
    text-align: center;
}

.binance-modal-logo {
    height: 35px; /* Adjust logo size */
}

.qr-code-wrapper {
    position: relative;
    padding: 10px; /* Reduce padding */
    border: 3px solid #FCD535; /* Thicker border */
    border-radius: 12px;
    margin-bottom: 5px; /* Reduce margin */
    background-color: white;
}

#qr-code {
    display: block; /* Ensure it behaves like a block element */
    width: 180px; /* Slightly smaller QR code */
    height: 180px;
}

.qr-scan-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px; /* Adjust overlay size */
    height: 50px;
}

#payment-qr > p:first-of-type { /* Target the "Scan the QR code..." text */
    font-size: 15px;
    color: var(--text-color);
    margin-bottom: 10px;
    text-align: center;
}

/* Payment Links Section */
#payment-links {
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.payment-note {
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 15px;
}

.btn-secondary.btn-sm { /* Style the Open Binance Pay button */
    padding: 10px 20px;
    font-size: 14px;
    border-width: 1px;
    display: inline-flex; /* Ensure it behaves correctly */
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    background-color: #FCD535;
    color: #1E2329;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-secondary.btn-sm:hover {
    background-color: #F0B90B;
}

.payment-amount {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

/* Countdown Timer */
.countdown {
    font-size: 14px;
    color: var(--text-color);
    margin-top: 15px;
    text-align: center;
}

#countdown {
    font-weight: 600;
    color: var(--primary-color);
}

/* Payment Success State */
#payment-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 15px;
}

.success-icon img {
    width: 80px;
    height: 80px;
}

#payment-success h3 {
    font-size: 24px;
    color: #10b981; /* Green color for success */
    font-weight: 600;
    margin: 0;
}

#payment-success p {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 15px;
}

#continue-btn {
    padding: 12px 30px;
    width: auto;
}

/* Payment Error State */
#payment-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 15px;
}

.error-icon i {
    font-size: 60px;
    color: #ef4444; /* Red color for error */
}

#payment-error h3 {
    font-size: 24px;
    color: #ef4444;
    font-weight: 600;
    margin: 0;
}

#payment-error p {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 15px;
}

#retry-btn {
    padding: 12px 30px;
    width: auto;
}

/* M-Pesa Payment */
#payment-mpesa {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.mpesa-brand {
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mpesa-brand img {
    height: 50px;
    transition: all 0.3s ease;
}

.mpesa-steps {
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.mpesa-steps h4 {
    color: #1a73e8;
    margin-bottom: 15px;
    font-size: 18px;
}

.mpesa-steps ol {
    margin: 0;
    padding-left: 25px;
}

.mpesa-steps ol li {
    margin-bottom: 12px;
    line-height: 1.6;
    color: var(--text-color);
    position: relative;
}

.mpesa-details {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.whatsapp-verification {
    width: 100%;
    transition: all 0.3s ease;
}

.whatsapp-verification h4 {
    font-size: 18px;
    margin-bottom: 12px;
}

.whatsapp-verification a {
    transition: all 0.3s ease;
}

.whatsapp-verification a:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.mpesa-confirmation {
    margin-top: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
}

#mpesa-confirm-btn {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 30px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#mpesa-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.countdown {
    font-size: 16px;
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mpesa-countdown {
    font-weight: 700;
    color: #1a73e8;
    margin-left: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .checkout-container {
        flex-direction: column-reverse;
    }
    
    .checkout-steps {
        display: none;
    }
    
    .payment-option {
        padding: 12px;
    }
    
    .modal-content {
        max-width: 90%;
    }
    
    .qr-code-wrapper {
        padding: 8px;
    }
    
    #qr-code {
        width: 150px;
        height: 150px;
    }
    
    /* Responsive M-Pesa Styling */
    #payment-mpesa {
        padding: 0 10px;
    }
    
    .mpesa-brand img {
        height: 40px;
    }
    
    .mpesa-details > div {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 5px;
        padding-bottom: 10px;
    }
    
    .mpesa-steps h4,
    .whatsapp-verification h4 {
        font-size: 16px;
    }
    
    .mpesa-steps ol li {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .whatsapp-verification p {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        max-width: 95%;
        padding: 15px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    #payment-mpesa {
        padding: 0;
    }
    
    .mpesa-details {
        padding: 15px;
    }
    
    .mpesa-steps {
        padding: 15px !important; 
    }
    
    .whatsapp-verification {
        padding: 12px !important;
    }
    
    .mpesa-brand img {
        height: 35px;
    }
    
    #mpesa-confirm-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}
