/* ============================================================
   Stripe Card Animation - Premium 3D Credit Card UI
   ============================================================ */

/* Side-by-side: inputs LEFT, card RIGHT */
.stripe-payment-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 28px;
    margin-bottom: 4px;
}

/* Left column: form inputs, grows to fill available space */
.stripe-form-col {
    flex: 1 1 0;
    min-width: 0; /* prevent overflow */
}

/* Right column: card, fixed width so it doesn't squish */
.stripe-card-col {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Wrapper to prevent overflow clipping from parent */
.stripe-card-scene {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* 3D card container */
.stripe-card-wrapper {
    position: relative;
    width: 480px;
    height: 290px;
    transform-style: preserve-3d;
    transition: transform 0.65s cubic-bezier(0.455, 0.03, 0.515, 0.955);
    perspective: 1000px;
    cursor: default;
    flex-shrink: 0;
}

/* Apply flip when CVV is focused */
.stripe-card-wrapper.is-flipped {
    transform: rotateY(180deg);
}

/* ── Shared face styles ────────────────────────────── */
.stripe-card-front,
.stripe-card-back {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    padding: 24px 28px;
    color: #fff;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    box-shadow:
        0 3px 20px rgba(0,0,0,0.4),
        0 0 0 1px rgba(255,255,255,0.06);
}

/* ── Front face ────────────────────────────────────── */
.stripe-card-front {
    background: linear-gradient(135deg,
        #1a1a42 0%,
        #2e1d72 40%,
        #5962b3 75%,
        #ae97ff 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Decorative circles on front */
.stripe-card-front::before,
.stripe-card-front::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.stripe-card-front::before {
    width: 220px;
    height: 220px;
    background: rgba(255,255,255,0.07);
    top: -70px;
    right: -50px;
}

.stripe-card-front::after {
    width: 160px;
    height: 160px;
    background: rgba(255,255,255,0.05);
    bottom: -60px;
    left: 10px;
}

/* ── Back face ─────────────────────────────────────── */
.stripe-card-back {
    background: linear-gradient(135deg,
        #0e0e2a 0%,
        #1a1b50 50%,
        #4a52a3 100%
    );
    transform: rotateY(180deg);
}

/* Magnetic strip */
.card-back-strip {
    position: absolute;
    top: 42px;
    left: 0;
    right: 0;
    height: 46px;
    background: #0a0a0a;
}

/* CVV box */
.card-cvv-wrapper {
    position: absolute;
    top: 108px;
    left: 28px;
    right: 28px;
}

.card-cvv-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.55);
    margin-bottom: 6px;
}

.card-cvv-box {
    background: #fff;
    border-radius: 6px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 16px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: #1a1a3e;
    letter-spacing: 6px;
    font-weight: bold;
}

/* ── Chip ────────────────────────────── */
.card-chip {
    width: 46px;
    height: 34px;
    border-radius: 6px;
    background: linear-gradient(145deg, #d4a843 0%, #f5c842 50%, #b8921f 100%);
    position: relative;
    flex-shrink: 0;
}

.card-chip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 1px;
    background: rgba(0,0,0,0.2);
    transform: translateY(-50%);
}

.card-chip::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0; bottom: 0;
    width: 1px;
    background: rgba(0,0,0,0.2);
    transform: translateX(-50%);
}

/* ── Card number display ─────────────── */
.card-number-display {
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    letter-spacing: 3px;
    color: #fff;
    display: flex;
    gap: 14px;
    align-items: center;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.card-number-group {
    display: inline-block;
    min-width: 3ch;
}

/* ── Card bottom info row ─────────────── */
.card-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
}

.card-holder-label,
.card-expiry-label {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.55);
    margin-bottom: 4px;
    display: block;
}

.card-holder-name,
.card-expiry-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: block;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ── Card type logo ─────────────────── */
.card-type-logo {
    position: absolute;
    top: 20px;
    right: 22px;
    height: 34px;
    display: flex;
    align-items: center;
}

.card-type-logo svg,
.card-type-logo img {
    height: 30px;
    width: auto;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

/* ============================================================
   Stripe Element Input Containers — match .bm-input-group style
   ============================================================ */

.stripe-element-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 15px 20px;
    min-height: 52px;
    cursor: text;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.stripe-element-container > * {
    flex: 1;
    width: 100%;
}

.stripe-element-container:focus-within {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ae97ff;
    box-shadow: 0 0 0 4px rgba(174, 151, 255, 0.1);
}

/* Card form layout */
.stripe-card-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stripe-card-form-grid .col-span-2 {
    grid-column: 1 / -1;
}

/* Cardholder name text input */
#card-name-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 15px 20px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

#card-name-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ae97ff;
    box-shadow: 0 0 0 4px rgba(174, 151, 255, 0.1);
}

#card-name-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Security strip */
.stripe-security-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stripe-security-row svg { flex-shrink: 0; }

.stripe-security-row span {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45) !important;
    letter-spacing: 0.2px;
    line-height: 1.4;
}

/* Payment error */
#stripe-payment-error {
    color: #ff5e8b;
    font-size: 13px;
    margin-top: 0;
    height: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

#stripe-payment-error.active {
    height: 18px;
    margin-top: 10px;
    opacity: 1;
}

/* Error state for total container */
#summaryAccordion {
    transition: margin-top 0.3s ease;
    margin-top: 1.5rem;
}

#summaryAccordion.error {
    margin-top: 0.8rem;
}

/* Spin animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}
