:root {
    --bg-color: #ffffff;
    --text-color: #1a1f36;
    --text-muted: #4f5b66;
    --border-color: #e3e8ee;
    --input-bg: #ffffff;
    --primary-color: #0055ff;
    --primary-hover: #0044cc;
    --error-color: #df1b41;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: #f7f8f9;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.checkout-container {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    width: 100%;
    max-width: 1000px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(50,50,93,.1), 0 5px 15px rgba(0,0,0,.07);
    overflow: hidden;
}

@media (max-width: 768px) {
    .checkout-container {
        grid-template-columns: 1fr;
    }
}

/* Left Side: Order Summary */
.order-summary {
    background-color: #ffffff;
    padding: 40px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 30px;
}

.back-link:hover {
    color: var(--text-color);
}

.merchant-name {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.product-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.price-display {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 30px;
}

.price-display .amount {
    font-size: 2.5rem;
    font-weight: 700;
}

.price-display .currency {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.price-display .billing-cycle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.order-items {
    margin-bottom: 20px;
}

.item {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.item-qty {
    display: block;
    font-size: 0.8rem;
    color: #a3acb9;
}

.pricing-breakdown {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-bottom: auto; /* Pushes content above up */
}

.pricing-breakdown .row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.pricing-breakdown .row.total {
    color: var(--text-color);
    font-weight: 600;
    font-size: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 10px;
}

.secure-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #a3acb9;
    margin-top: 20px;
}

/* Right Side: Payment Form */
.payment-section {
    padding: 40px;
    background-color: #ffffff;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-color);
}

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

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

input[type="text"],
input[type="email"],
select {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 0.95rem;
    font-family: inherit;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.1);
}

/* Card Input Specifics */
.card-input-container {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.input-with-icon {
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.input-with-icon input {
    border: none;
    border-radius: 0;
}

.card-brand-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.card-sub-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.card-sub-fields input {
    border: none;
    border-radius: 0;
}

.card-sub-fields input:first-child {
    border-right: 1px solid var(--border-color);
}

/* Billing Address */
.billing-address-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 12px;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
    margin-top: 10px;
}

.submit-btn:hover {
    background-color: var(--primary-hover);
}

.terms-text {
    font-size: 0.75rem;
    color: #697386;
    margin-top: 15px;
    text-align: center;
    line-height: 1.4;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.success-icon {
    width: 50px;
    height: 50px;
    background: #00ca72;
    color: white;
    font-size: 1.5rem;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
}

.modal h2 {
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.modal p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.modal button {
    width: 100%;
    padding: 10px;
    background: #f7f8f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-weight: 500;
    cursor: pointer;
}

.modal button:hover {
    background: #e3e8ee;
}
