/* ==================================================
   PayPal Payment Collector - Frontend Styles
   ================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Step indicators */
.ppc-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-top: 20px;
}

.ppc-step {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.45;
    transition: opacity 0.3s ease;
}

.ppc-step-active { opacity: 1; }
.ppc-step-done   { opacity: 0.7; }

.ppc-step-num {
    width: 26px;
    height: 26px;
    background: rgba(255,255,255,0.25);
    border: 2px solid rgba(255,255,255,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.ppc-step-active .ppc-step-num {
    background: #fff;
    color: #0070ba;
    border-color: #fff;
}

.ppc-step-done .ppc-step-num::before { content: '✓'; }
.ppc-step-done .ppc-step-num span    { display: none; }

.ppc-step-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
}

.ppc-step-divider {
    width: 48px;
    height: 2px;
    background: rgba(255,255,255,0.3);
    margin: 0 8px;
    flex-shrink: 0;
}

.ppc-form-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 520px;
    margin: 40px auto;
    padding: 0 16px;
}

/* Card */
.ppc-form-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow:
        0 4px 6px -1px rgba(0,0,0,0.07),
        0 20px 60px -10px rgba(37,59,128,0.15);
    overflow: hidden;
    border: 1px solid rgba(37,59,128,0.08);
    animation: ppcSlideUp 0.5s ease;
}

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

/* Header */
.ppc-form-header {
    background: linear-gradient(135deg, #003087 0%, #009cde 100%);
    padding: 36px 40px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ppc-form-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.12) 0%, transparent 60%);
    pointer-events: none;
}

.ppc-paypal-logo {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    filter: brightness(0) invert(1);
}

.ppc-form-title {
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 8px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.ppc-form-desc {
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    margin: 0;
}

/* Form body */
.ppc-form-card form {
    padding: 0;
}

.ppc-form-body {
    padding: 36px 40px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Fields */
.ppc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.ppc-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ppc-label-icon {
    font-size: 1rem;
}

.ppc-required {
    color: #ef4444;
    font-weight: 700;
}

.ppc-input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #111827;
    background: #f9fafb;
    transition: all 0.2s ease;
    box-sizing: border-box;
    outline: none;
}

.ppc-input:focus {
    border-color: #0070ba;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(0,112,186,0.12);
}

.ppc-input.ppc-input-error {
    border-color: #ef4444;
    background: #fff7f7;
}

.ppc-input.ppc-input-error:focus {
    box-shadow: 0 0 0 4px rgba(239,68,68,0.12);
}

.ppc-input.ppc-input-valid {
    border-color: #22c55e;
}

/* Amount field */
.ppc-amount-wrapper {
    display: flex;
    align-items: center;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    overflow: hidden;
    transition: all 0.2s ease;
}

.ppc-amount-wrapper:focus-within {
    border-color: #0070ba;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(0,112,186,0.12);
}

.ppc-currency-symbol {
    padding: 13px 14px;
    font-weight: 700;
    color: #0070ba;
    font-size: 1rem;
    background: rgba(0,112,186,0.05);
    border-right: 1px solid #e5e7eb;
    white-space: nowrap;
}

.ppc-amount-input {
    flex: 1;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.ppc-currency-code {
    padding: 13px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    background: rgba(0,0,0,0.02);
    border-left: 1px solid #e5e7eb;
}

/* Error messages */
.ppc-field-error {
    font-size: 0.8rem;
    color: #ef4444;
    font-weight: 500;
    display: none;
    animation: ppcFadeIn 0.2s ease;
}

.ppc-field-error.visible {
    display: block;
}

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

/* Alert box */
.ppc-alert {
    margin: 0 40px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    animation: ppcFadeIn 0.3s ease;
}

.ppc-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.ppc-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

/* ─── Continue / Submit button ─── */
.ppc-continue-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #0070ba 0%, #003087 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,112,186,0.35);
}

.ppc-continue-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s ease;
}

.ppc-continue-btn:hover::before {
    left: 100%;
}

.ppc-continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,112,186,0.45);
}

.ppc-continue-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0,112,186,0.35);
}

.ppc-continue-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ppc-btn-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ppc-paypal-icon {
    flex-shrink: 0;
}

/* Loading spinner */
.ppc-btn-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ppc-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    animation: ppcSpin 0.8s linear infinite;
}

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

/* Secure note */
.ppc-secure-note {
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    padding-bottom: 4px;
}

/* ─── Payment Summary (Step 2) ─── */
.ppc-payment-summary {
    background: linear-gradient(135deg, #f0f9ff, #eff6ff);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ppc-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(186,230,253,0.5);
    font-size: 0.9rem;
}

.ppc-summary-row:last-child { border-bottom: none; }

.ppc-summary-label {
    color: #0369a1;
    font-weight: 500;
    font-size: 0.85rem;
}

.ppc-summary-value {
    font-weight: 600;
    color: #0f172a;
    text-align: right;
    word-break: break-all;
}

.ppc-summary-amount-row { margin-top: 4px; }

.ppc-summary-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0070ba;
}

/* ─── PayPal buttons section ─── */
.ppc-choose-label {
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    margin: 0;
}

#ppc-paypal-buttons {
    min-height: 50px;
}

/* ─── Back button ─── */
.ppc-btn-back-wrap {
    text-align: center;
}

.ppc-back-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.ppc-back-btn:hover {
    background: #f1f5f9;
    color: #374151;
}

/* ─── Processing Overlay ─── */
.ppc-processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(4px);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.ppc-processing-inner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ppc-processing-inner p {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.ppc-processing-inner small {
    color: #94a3b8;
    font-size: 0.8rem;
}

.ppc-processing-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: #0070ba;
    border-radius: 50%;
    animation: ppcSpin 0.9s linear infinite;
}

/* Make the card position relative for overlay */
.ppc-form-card { position: relative; overflow: hidden; }

/* ============ Result Pages ============ */
.ppc-result-wrapper {
    font-family: 'Inter', -apple-system, sans-serif;
    max-width: 500px;
    margin: 40px auto;
    padding: 0 16px;
}

.ppc-result-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    animation: ppcSlideUp 0.5s ease;
}

.ppc-result-icon-wrap {
    margin-bottom: 24px;
}

.ppc-result-icon-wrap svg {
    animation: ppcBounce 0.6s ease 0.2s both;
}

@keyframes ppcBounce {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.ppc-result-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 12px;
}

.ppc-result-success .ppc-result-title { color: #15803d; }
.ppc-result-cancel  .ppc-result-title { color: #b91c1c; }

.ppc-result-message {
    color: #6b7280;
    font-size: 0.95rem;
    margin: 0 0 28px;
}

/* Receipt */
.ppc-receipt {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 28px;
    text-align: left;
    border: 1px solid #e5e7eb;
}

.ppc-receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
    gap: 12px;
}

.ppc-receipt-row:last-child { border-bottom: none; }

.ppc-receipt-label { color: #6b7280; font-weight: 500; flex-shrink: 0; }
.ppc-receipt-value { font-weight: 600; color: #111827; text-align: right; word-break: break-all; }
.ppc-receipt-amount { color: #15803d; font-size: 1.1rem; }
.ppc-txn-id { font-family: monospace; font-size: 0.8rem; }

/* Result buttons */
.ppc-result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.ppc-result-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ppc-btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(34,197,94,0.3);
}

.ppc-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(34,197,94,0.4);
    color: #ffffff;
}

.ppc-btn-retry {
    background: linear-gradient(135deg, #0070ba, #003087);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0,112,186,0.3);
}

.ppc-btn-retry:hover {
    transform: translateY(-2px);
    color: #ffffff;
}

.ppc-btn-home {
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.ppc-btn-home:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
    color: #374151;
}

/* Status badges */
.ppc-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: capitalize;
}

.ppc-status-completed  { background: #dcfce7; color: #166534; }
.ppc-status-pending    { background: #fef9c3; color: #854d0e; }
.ppc-status-failed     { background: #fee2e2; color: #991b1b; }
.ppc-status-cancelled  { background: #f3f4f6; color: #374151; }

/* Responsive */
@media (max-width: 540px) {
    .ppc-form-header { padding: 28px 24px 24px; }
    .ppc-form-body { padding: 24px 24px 20px; }
    .ppc-form-title { font-size: 1.35rem; }
    .ppc-alert { margin: 0 24px; }
    .ppc-result-card { padding: 36px 24px; }
    .ppc-step-label { display: none; }
    .ppc-step-divider { width: 24px; }
}
