:root {
    --text-color: #2c3e50;
    --light-bg: #f8fafc;
    --input-border: #e2e8f0;
    --focus-border: #3b82f6;
    --error-color: #ef4444;
    --success-color: #10b981;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --button-text-color: #ffffff;
    
    --border: #e2e8f0; 
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* --- General Structure & Typography --- */
.icon-primary {
  color: var(--primary);
}

.checkout-container {
    display: flex;
    flex-direction: row-reverse;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    direction: rtl;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- Checkout Form Container --- */
#checkout-form {
    flex: 2;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 24px;
}

#checkout-form h2 {
    font-size: 1.6em;
    color: var(--text-color);
    margin-bottom: 20px;
    text-align: right;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Cart Summary Section --- */
.cart-summary-section {
    flex: 1;
    background: var(--light-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.cart-summary-section h2 {
    font-size: 1.4em;
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 20px;
    text-align: right;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-items-list {
    border-bottom: 1px dashed #e2e8f0;
    margin-bottom: 15px;
    padding-bottom: 10px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px 0;
    border-top: 1px dashed #f1f5f9;
}
.cart-item:first-child {
    border-top: none;
}

.cart-item-image img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.cart-item-details {
    flex-grow: 1;
    text-align: right;
}

.cart-item-details h4 {
    margin: 0 0 5px 0;
    font-size: 1em;
    font-weight: 600;
    color: var(--text-color);
}

.cart-item-attributes {
    font-size: 0.85em;
    color: #64748b;
    margin-bottom: 5px;
}

.attribute-badge {
    display: inline-block;
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 5px;
    font-size: 0.8em;
    font-weight: 500;
}

.cart-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: #64748b;
}

.cart-item-total {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--primary);
    white-space: nowrap;
}

.cart-subtotal {
    display: flex;
    justify-content: space-between;
    font-size: 1em;
    padding-top: 5px;
    padding-bottom: 10px;
    color: var(--text-color);
}
.cart-subtotal strong {
    color: var(--primary);
}

/* --- Checkout Summary --- */
.checkout-summary {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e2e8f0;
    font-size: 1em;
    line-height: 1.8;
    color: var(--text-color);
    width: 100%;
    box-sizing: border-box;
    text-align: right;
}
.checkout-summary h4 {
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: bold;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}
.summary-row.total-row {
    font-size: 1.2em;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    margin-top: 10px;
    color: var(--text-color);
}
.summary-row strong {
    color: var(--primary);
    font-size: 1em;
    font-weight: 700;
}
.summary-row span {
    font-weight: 500;
}

/* --- Form Field Styles --- */
.form-fields-container {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}
.form-fields-container > div {
    flex: 1 1 calc(50% - 7.5px);
    box-sizing: border-box;
}

.form-field {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.form-field label {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}

#checkout-form input[type="text"],
#checkout-form input[type="tel"],
#checkout-form select,
#checkout-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 0.95em;
    color: var(--text-color);
    background-color: #fff;
    transition: all 0.3s ease;
    box-sizing: border-box;
    text-align: right;
}

#checkout-form input:focus,
#checkout-form select:focus,
#checkout-form textarea:focus {
    border-color: var(--focus-border);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
    background-color: #f8fafc;
}
#checkout-form input::placeholder,
#checkout-form textarea::placeholder {
    color: #94a3b8;
    font-style: italic;
    font-size: 0.9em;
    text-align: right;
}
#checkout-form select option[value=""] {
    color: #64748b;
}
#checkout-form select:invalid {
    color: #64748b;
}

.form-field.full-width {
    flex: 1 1 100%;
}

/* --- Submit Button --- */
.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-checkout {
    background: var(--primary);
    color: var(--button-text-color);
    padding: 12px 30px;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-direction: row-reverse;
    width: auto;
    max-width: 100%;
}

.btn-checkout:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.btn-checkout:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.btn-checkout .dashicons {
    font-size: 1.3em;
    width: 1.3em;
    height: 1.3em;
}

/* --- Message Display Area --- */
#checkout-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.95em;
    font-weight: 600;
    text-align: center;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}
#checkout-message.active {
    display: block;
    opacity: 1;
}
#checkout-message.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
#checkout-message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* --- Empty Cart Message --- */
.empty-cart-message {
    text-align: center;
    padding: 40px 20px;
    margin: 50px auto;
    max-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.empty-cart-message h3 {
    margin-top: 15px;
    color: var(--text-color);
}
.empty-cart-message p {
    color: #64748b;
    margin-bottom: 20px;
}
.btn-continue-shopping {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}
.btn-continue-shopping:hover {
    background: var(--primary-hover);
}

/* --- Success Popup Styles --- */
#checkout-success-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    direction: rtl;
}

#checkout-success-popup-container {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: 16px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    transform: translateY(0);
    animation: fadeIn 0.3s ease-out;
}

.popup-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    left: auto; 
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.popup-close-btn:hover {
    color: #64748b;
}

#checkout-success-popup-header {
    margin-bottom: 2rem;
}

#checkout-success-popup-header h2 {
    font-size: 2rem;
    color: var(--success-color);
    margin-bottom: 0.5rem;
}

.success-icon {
    font-size: 5rem;
    color: var(--success-color);
    margin-bottom: 1rem;
    animation: bounceIn 0.5s ease-out;
}

#checkout-success-popup-body p {
    font-size: 1.2rem;
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

#checkout-success-popup-body p strong {
    color: var(--text-color);
}

#checkout-success-popup-body .small-text {
    font-size: 1rem;
    color: #64748b;
    margin-top: 2rem;
}

.popup-actions {
    margin-top: 20px;
}

.btn-continue {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 10px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.btn-continue:hover {
    background: var(--primary-hover);
}

/* --- Responsive Adjustments --- */
@media (min-width: 768px) {
    .form-fields-container > div {
        flex: 1 1 calc(50% - 7.5px);
    }
    .form-field.full-width {
        flex: 1 1 100%;
    }
}

@media (max-width: 991px) {
    .checkout-container {
        flex-direction: column;
        gap: 20px;
        margin: 10px auto;
        padding: 0 10px;
    }
    #checkout-form, .cart-summary-section {
        flex: 1 1 100%;
    }
}

@media (max-width: 767px) {
    .form-fields-container {
        flex-direction: column;
        gap: 15px;
    }
    .form-fields-container > div {
        flex: 1 1 100%;
    }
    #checkout-form {
        padding: 15px;
    }
    .cart-summary-section {
        padding: 15px;
    }
    .cart-item-image img {
        width: 50px;
        height: 50px;
    }
    .btn-checkout {
        width: 100%;
        padding: 12px 10px;
        font-size: 1em;
    }
}

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% { transform: scale(0.1); opacity: 0; }
    60% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Floating Labels */
.floating-label {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #3b82f6;  /* <-- Changed to blue */
    z-index: 2;
    transition: color 0.3s ease;
}

.input-with-icon input,
.input-with-icon select {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.input-with-icon select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
}

.input-with-icon label {
    position: absolute;
    right: 45px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 16px;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 2;
    background: #fff;
    padding: 0 8px;
}

.input-with-icon.focused label,
.input-with-icon.has-value label {
    top: 0;
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

.input-with-icon.focused i {
    color: var(--primary);
}

.input-with-icon input:focus,
.input-with-icon select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Shipping Cards - BLUE THEME */
.shipping-cards-section {
    margin: 2rem 0;
}

.shipping-cards-section h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.1rem;
    text-align: right;
    font-weight: 600;
}

.shipping-cards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.shipping-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--card-bg);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 180px;
    justify-content: center;
    box-shadow: var(--shadow);
}

.shipping-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.shipping-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.2);
}

.shipping-card.active::before {
    content: '✓';
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.shipping-card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    width: 100%;
}

.shipping-card-header i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.shipping-card-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 600;
}

.shipping-card-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.shipping-card-description {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.4;
    max-width: 100%;
}

/* Form Fields Container Updates */
.form-fields-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-fields-container .form-field.full-width {
    grid-column: 1 / -1;
}

/* Responsive Design for Shipping Cards */
@media (max-width: 768px) {
    .shipping-cards-container {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .shipping-card {
        padding: 1rem;
        min-height: 160px;
    }
    
    .shipping-card-header i {
        font-size: 1.75rem;
    }
    
    .shipping-card-header h4 {
        font-size: 0.9rem;
    }
    
    .shipping-card-price {
        font-size: 1.3rem;
    }
    
    .shipping-card-description {
        font-size: 0.8rem;
    }
    
    .input-with-icon input,
    .input-with-icon select {
        padding: 12px 12px 12px 40px;
    }
    
    .input-with-icon i {
        left: 12px;
    }
    
    .input-with-icon label {
        right: 40px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .shipping-cards-container {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .shipping-card {
        padding: 0.75rem;
        min-height: 140px;
    }
    
    .shipping-card-header i {
        font-size: 1.5rem;
    }
    
    .shipping-card-header h4 {
        font-size: 0.85rem;
    }
    
    .shipping-card-price {
        font-size: 1.1rem;
    }
    
    .shipping-card-description {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .form-fields-container {
        grid-template-columns: 1fr;
    }
}