/**
 * Checkout Page Styles
 * @package BookmarkIE
 * @version 2.1.0
 */

/* ============================================
   Checkout Container (Two-Column Layout)
   ============================================ */
.checkout-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ============================================
   Shared Card Styles
   ============================================ */
.checkout-summary,
.checkout-form {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

.checkout-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
}

.checkout-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.checkout-section:last-of-type {
    border-bottom: none;
    margin-bottom: 16px;
    padding-bottom: 0;
}

/* ============================================
   Order Summary (Left Column)
   ============================================ */
.checkout-plan-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    overflow-wrap: break-word;
    min-width: 0;
}

.checkout-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.checkout-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
}

.checkout-features li svg {
    flex-shrink: 0;
    color: var(--primary);
}

/* ============================================
   Billing Info Panel
   ============================================ */
.checkout-billing-info {
    background: var(--bg-hover, #f8fafc);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.billing-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.95rem;
    color: var(--text-main);
}

.billing-info-row:not(:last-child) {
    border-bottom: 1px solid var(--border-light);
}

.billing-info-bonus {
    color: var(--primary);
    font-weight: 600;
}

/* ============================================
   Money-Back Guarantee Badge
   ============================================ */
.checkout-guarantee {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
}

.checkout-guarantee svg {
    flex-shrink: 0;
    color: #16a34a;
    margin-top: 2px;
}

.checkout-guarantee strong {
    display: block;
    font-size: 0.95rem;
    color: #166534;
    margin-bottom: 2px;
}

.checkout-guarantee span {
    font-size: 0.85rem;
    color: #14532d;
    line-height: 1.4;
}

/* ============================================
   Registration Fields
   ============================================ */
.checkout-field {
    margin-bottom: 16px;
}

.checkout-field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.checkout-field input {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-main);
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.checkout-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 106, 0.15);
}

.checkout-field input:focus:not(:focus-visible) {
    outline: none;
}

.checkout-field input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.checkout-field input.field-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.checkout-field-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.checkout-login-link {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.checkout-login-link a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
}

.checkout-login-link a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Required field indicator */
.required-indicator {
    color: #dc2626;
    margin-left: 2px;
    font-weight: 400;
}

.checkout-required-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Inline field validation errors */
.checkout-field-error {
    display: block;
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 4px;
    font-weight: 500;
}

/* ============================================
   User Info (logged in)
   ============================================ */
.checkout-user-info p {
    font-size: 0.95rem;
    color: var(--text-main);
}

/* ============================================
   Duration Dropdown Selector
   ============================================ */
.checkout-select {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', 'Consolas', 'DejaVu Sans Mono', monospace;
    letter-spacing: -0.02em;
    color: var(--text-main);
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.checkout-select:hover {
    border-color: var(--primary);
}

.checkout-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 106, 0.15);
    outline: none;
}

.checkout-select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.checkout-select option {
    padding: 8px;
    font-weight: 500;
}

.checkout-price-display {
    margin-top: 12px;
    padding: 14px 16px;
    background: var(--bg-hover, #f8fafc);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}

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

.checkout-price-display .price-amount {
    font-size: 1.5rem;
    display: block;
}

.checkout-price-display .price-recurring {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}

/* ============================================
   Payment Method Selector
   ============================================ */
.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-method {
    display: block;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.payment-method:hover {
    border-color: var(--primary);
}

.payment-method--selected {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.payment-method:focus-within {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

.payment-method input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.payment-method-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

.payment-method-label svg {
    flex-shrink: 0;
}

/* ============================================
   Pay Button
   ============================================ */
.checkout-pay-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    background-color: #0070e0;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
    line-height: 1.5;
    margin-bottom: 12px;
}

.checkout-pay-btn:hover {
    background-color: #005bb5;
}

.checkout-pay-btn:focus-visible {
    outline: 2px solid #005bb5;
    outline-offset: 2px;
}

.checkout-pay-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.checkout-pay-btn--loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

@media (prefers-reduced-motion: reduce) {
    .checkout-pay-btn--loading::before {
        animation: none;
    }
}

.checkout-terms {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

/* ============================================
   Trial Section (kept for trial-only plans)
   ============================================ */
.checkout-trial-section {
    text-align: center;
    padding: 24px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.checkout-trial-plan {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.checkout-trial-days {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.checkout-trial-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.checkout-trial-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    background-color: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
    line-height: 1.5;
}

.checkout-trial-btn:hover {
    background-color: var(--primary-dark);
}

.checkout-trial-btn:focus-visible {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

.checkout-trial-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.checkout-trial-cycle-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.checkout-trial-btn--loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@media (prefers-reduced-motion: reduce) {
    .checkout-trial-btn--loading::before {
        animation: none;
    }
}

/* ============================================
   Status Messages
   ============================================ */
.checkout-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.checkout-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.checkout-info {
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   Plan Not Found / No Options
   ============================================ */
.checkout-not-found,
.checkout-no-options {
    text-align: center;
    padding: 60px 20px;
    max-width: 480px;
    margin: 0 auto;
}

.checkout-not-found h2,
.checkout-no-options h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 12px;
}

.checkout-not-found p,
.checkout-no-options p {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ============================================
   Responsive: Single Column Below 700px
   ============================================ */
@media (max-width: 700px) {
    .checkout-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px 16px;
    }

    .checkout-summary,
    .checkout-form {
        padding: 24px 20px;
    }

    .checkout-plan-name {
        font-size: 1.25rem;
    }

    .checkout-pay-btn {
        font-size: 1rem;
    }
}

/* ============================================
   Focus-visible for links in status messages
   ============================================ */
.checkout-success a {
    text-decoration: underline;
    font-weight: 600;
}

.checkout-success a:focus-visible,
.checkout-error a:focus-visible,
.checkout-info a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Focus indicator for programmatically focused status element */
#checkout-status:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

#checkout-status:focus:not(:focus-visible) {
    outline: none;
}

.checkout-terms a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ============================================
   Print Stylesheet
   ============================================ */
@media print {
    .checkout-container {
        display: block;
    }

    .checkout-form,
    .checkout-pay-btn,
    .checkout-trial-btn,
    .payment-methods,
    .checkout-terms,
    .checkout-login-link {
        display: none;
    }

    .checkout-summary {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
