/**
 * WooCommerce Cart Modal Checkout - Styles
 * 
 * Responsive modal styling with smooth animations
 */

/* ========================================
   Modal Container & Overlay
   ======================================== */

.woo-cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.woo-cart-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease-in-out;
}

.woo-cart-modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideDown 0.3s ease-in-out;
    z-index: 1000000;
}

/* Prevent body scroll when modal is open */
body.woo-cart-modal-open {
    overflow: hidden;
}

/* ========================================
   Messages & Alerts
   ======================================== */

.woo-cart-modal-messages {
    margin-bottom: 20px;
}

.woo-cart-modal-messages .woocommerce-message,
.woo-cart-modal-messages .woocommerce-error,
.woo-cart-modal-messages .woocommerce-info {
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.woo-cart-modal-messages .woocommerce-message {
    background-color: #f0f9ff;
    border-left: 4px solid #0073aa;
    color: #0073aa;
}

.woo-cart-modal-messages .woocommerce-error {
    background-color: #fff5f5;
    border-left: 4px solid #dc3232;
    color: #dc3232;
}

.woo-cart-modal-messages .woocommerce-info {
    background-color: #fffbf0;
    border-left: 4px solid #ffb900;
    color: #856404;
}

/* Loading state for buttons */
button.loading,
input[type="submit"].loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

button.loading::after,
input[type="submit"].loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ========================================
   Close Button
   ======================================== */

.woo-cart-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woo-cart-modal-close:hover {
    background: #e74c3c;
    color: #fff;
    transform: rotate(90deg);
}

/* ========================================
   Tabs
   ======================================== */

.woo-cart-modal-tabs {
    display: flex;
    background: #f8f8f8;
    border-bottom: 2px solid #e0e0e0;
    padding: 0;
    margin: 0;
}

.woo-cart-modal-tab {
    flex: 1;
    padding: 18px 20px;
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.woo-cart-modal-tab:hover {
    background: #fff;
    color: #333;
}

.woo-cart-modal-tab.active {
    background: #fff;
    color: #2c3e50;
}

.woo-cart-modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: #3498db;
}

/* ========================================
   Modal Body
   ======================================== */

.woo-cart-modal-body {
    padding: 30px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
}

.woo-cart-modal-tab-content {
    display: none;
}

.woo-cart-modal-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.woo-cart-modal-body h2 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 24px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* ========================================
   Forms Styling
   ======================================== */

.woo-cart-modal-body form {
    margin-bottom: 20px;
}

.woo-cart-modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.woo-cart-modal-body input[type="text"],
.woo-cart-modal-body input[type="email"],
.woo-cart-modal-body input[type="password"],
.woo-cart-modal-body input[type="tel"],
.woo-cart-modal-body select,
.woo-cart-modal-body textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.woo-cart-modal-body input[type="text"]:focus,
.woo-cart-modal-body input[type="email"]:focus,
.woo-cart-modal-body input[type="password"]:focus,
.woo-cart-modal-body input[type="tel"]:focus,
.woo-cart-modal-body select:focus,
.woo-cart-modal-body textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.woo-cart-modal-body button[type="submit"],
.woo-cart-modal-body input[type="submit"],
.woo-cart-modal-body .button {
    background: #3498db;
    color: #fff;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.woo-cart-modal-body button[type="submit"]:hover,
.woo-cart-modal-body input[type="submit"]:hover,
.woo-cart-modal-body .button:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.woo-cart-modal-body button[type="submit"]:disabled,
.woo-cart-modal-body input[type="submit"]:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   Login Form Specific
   ======================================== */

#woo-cart-login-form p {
    margin-bottom: 15px;
}

#woo-cart-login-form .login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
}

#woo-cart-login-form .login-remember input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* ========================================
   WooCommerce Forms
   ======================================== */

.woo-cart-modal-body .woocommerce-form-row {
    margin-bottom: 15px;
}

.woo-cart-modal-body .woocommerce-form-row label {
    display: block;
    margin-bottom: 5px;
}

.woo-cart-modal-body .woocommerce-error,
.woo-cart-modal-body .woocommerce-message,
.woo-cart-modal-body .woocommerce-info {
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid;
}

.woo-cart-modal-body .woocommerce-error {
    background: #fee;
    border-left-color: #e74c3c;
    color: #c0392b;
}

.woo-cart-modal-body .woocommerce-message {
    background: #efe;
    border-left-color: #27ae60;
    color: #1e8449;
}

.woo-cart-modal-body .woocommerce-info {
    background: #eff;
    border-left-color: #3498db;
    color: #2471a3;
}

/* ========================================
   Checkout Form in Modal
   ======================================== */

.woo-cart-modal-body .woocommerce-checkout {
    max-width: 100%;
}

.woo-cart-modal-body .woocommerce-billing-fields h3,
.woo-cart-modal-body .woocommerce-shipping-fields h3,
.woo-cart-modal-body .woocommerce-additional-fields h3 {
    font-size: 18px;
    margin-top: 25px;
    margin-bottom: 15px;
    color: #2c3e50;
}

/* ========================================
   Loading State
   ======================================== */

.woo-cart-modal-loading {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    color: #3498db;
    font-weight: 600;
}

button.loading::after,
input[type="submit"].loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .woo-cart-modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
    }

    .woo-cart-modal-body {
        padding: 20px;
        max-height: calc(95vh - 70px);
    }

    .woo-cart-modal-tab {
        padding: 15px 10px;
        font-size: 14px;
    }

    .woo-cart-modal-body h2 {
        font-size: 20px;
    }

    .woo-cart-modal-close {
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .woo-cart-modal-tabs {
        flex-direction: column;
    }

    .woo-cart-modal-tab {
        border-bottom: 1px solid #e0e0e0;
    }

    .woo-cart-modal-tab.active::after {
        bottom: 0;
        height: 100%;
        width: 4px;
    }

    .woo-cart-modal-body {
        padding: 15px;
    }
}

/* ========================================
   Scrollbar Styling
   ======================================== */

.woo-cart-modal-body::-webkit-scrollbar {
    width: 8px;
}

.woo-cart-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.woo-cart-modal-body::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

.woo-cart-modal-body::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}
