/**
 * iShield Gateway PeachPay - Premium Checkout Styles
 * Refined luxury aesthetic for cosmetics/beauty checkout
 */

/* Import elegant font pairing */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Nunito+Sans:wght@300;400;500;600&display=swap');

/* CSS Variables - Warm luxury palette */
:root {
    --ishield-primary: #1a1a1a;
    --ishield-primary-soft: #2d2d2d;
    --ishield-accent: #c9a86c;
    --ishield-accent-light: #dfc799;
    --ishield-accent-glow: rgba(201, 168, 108, 0.15);
    --ishield-surface: #ffffff;
    --ishield-surface-elevated: #fafafa;
    --ishield-border: #e8e4df;
    --ishield-border-focus: #c9a86c;
    --ishield-text: #1a1a1a;
    --ishield-text-secondary: #6b6560;
    --ishield-text-muted: #9a948d;
    --ishield-success: #2d8a5f;
    --ishield-error: #c44536;
    --ishield-shadow-soft: 0 2px 8px rgba(26, 26, 26, 0.04), 0 4px 24px rgba(26, 26, 26, 0.06);
    --ishield-shadow-elevated: 0 4px 12px rgba(26, 26, 26, 0.06), 0 8px 32px rgba(26, 26, 26, 0.08);
    --ishield-radius: 12px;
    --ishield-radius-sm: 8px;
    --ishield-transition: cubic-bezier(0.4, 0, 0.2, 1);
    --ishield-font-display: 'Cormorant Garamond', Georgia, serif;
    --ishield-font-body: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Main form container reset */
#wc-ishield_peachpay_sdk-cc-form {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

#wc-ishield_peachpay_sdk-cc-form::before,
#wc-ishield_peachpay_sdk-cc-form::after {
    display: none !important;
}

/* Payment form wrapper with premium styling */
.ishield-payment-form {
    position: relative;
    font-family: var(--ishield-font-body);
    animation: ishield-fade-in 0.5s var(--ishield-transition) forwards;
}

@keyframes ishield-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main card input container */
.ishield-card-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--ishield-surface);
    border-radius: var(--ishield-radius);
    border: 1.5px solid var(--ishield-border);
    box-shadow: var(--ishield-shadow-soft);
    overflow: hidden;
    transition: all 0.3s var(--ishield-transition);
}

.ishield-card-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--ishield-accent) 0%, var(--ishield-accent-light) 50%, var(--ishield-accent) 100%);
    opacity: 0;
    transition: opacity 0.3s var(--ishield-transition);
}

.ishield-card-wrapper.focused {
    border-color: var(--ishield-border-focus);
    box-shadow: var(--ishield-shadow-elevated), 0 0 0 3px var(--ishield-accent-glow);
}

.ishield-card-wrapper.focused::before {
    opacity: 1;
}

.ishield-card-wrapper.has-error {
    border-color: var(--ishield-error);
    box-shadow: var(--ishield-shadow-soft), 0 0 0 3px rgba(196, 69, 54, 0.1);
}

.ishield-card-wrapper.valid {
    border-color: var(--ishield-success);
}

/* Card row styling */
.ishield-card-row {
    display: flex;
    align-items: center;
    min-height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid var(--ishield-border);
    background: var(--ishield-surface);
    transition: background 0.2s var(--ishield-transition);
}

.ishield-card-row:last-child {
    border-bottom: none;
}

.ishield-card-row:hover {
    background: var(--ishield-surface-elevated);
}

.ishield-card-row.focused {
    background: var(--ishield-surface-elevated);
}

/* Split row for expiry and CVC */
.ishield-card-row-split {
    display: flex;
    width: 100%;
}

.ishield-card-row-half {
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 60px;
    padding: 0 20px;
    background: var(--ishield-surface);
    transition: background 0.2s var(--ishield-transition);
}

.ishield-card-row-half:first-child {
    border-right: 1px solid var(--ishield-border);
}

.ishield-card-row-half:hover {
    background: var(--ishield-surface-elevated);
}

.ishield-card-row-half.focused {
    background: var(--ishield-surface-elevated);
}

/* Card brand icon container */
.ishield-card-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-width: 48px;
    height: 32px;
    margin-right: 16px;
    border-radius: 6px;
    background: var(--ishield-surface-elevated);
    border: 1px solid var(--ishield-border);
    transition: all 0.3s var(--ishield-transition);
    overflow: hidden;
}

.ishield-card-brand svg {
    width: 24px;
    height: 24px;
    color: var(--ishield-text-muted);
    transition: all 0.3s var(--ishield-transition);
}

.ishield-card-brand img {
    width: 36px;
    height: 24px;
    object-fit: contain;
}

.ishield-card-brand.detected {
    background: var(--ishield-surface);
    border-color: var(--ishield-accent);
    box-shadow: 0 0 0 2px var(--ishield-accent-glow);
}

/* Input field group with floating label */
.ishield-input-group {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Input fields */
.ishield-card-input {
    width: 100%;
    height: 40px;
    padding: 8px 0 0 0 !important;
    margin: 0 !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-family: var(--ishield-font-body) !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em;
    color: var(--ishield-text) !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    transition: color 0.2s var(--ishield-transition);
}

.ishield-card-input::placeholder {
    color: transparent;
}

.ishield-card-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.ishield-card-input.has-value,
.ishield-card-input:focus {
    padding-top: 14px !important;
}

/* Floating labels */
.ishield-card-label {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    font-family: var(--ishield-font-body);
    font-size: 15px;
    font-weight: 400;
    color: var(--ishield-text-secondary);
    pointer-events: none;
    transition: all 0.2s var(--ishield-transition);
}

.ishield-card-input:focus ~ .ishield-card-label,
.ishield-card-input.has-value ~ .ishield-card-label {
    top: 4px !important;
    transform: translateY(0) !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    letter-spacing: 0.03em;
    text-transform: none !important;
    color: var(--ishield-accent);
}

/* Field icons */
.ishield-field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    margin-left: 12px;
    color: var(--ishield-text-muted);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s var(--ishield-transition);
}

.ishield-field-icon.show {
    opacity: 1;
    transform: scale(1);
}

.ishield-field-icon.valid {
    color: var(--ishield-success);
}

.ishield-field-icon.error {
    color: var(--ishield-error);
}

.ishield-field-icon svg {
    width: 18px;
    height: 18px;
}

/* Card status/error message */
.ishield-card-status {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
    max-height: 0;
    padding: 0 4px;
    margin-top: 0;
    font-family: var(--ishield-font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--ishield-text-secondary);
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s var(--ishield-transition);
}

.ishield-card-status.show {
    min-height: 32px;
    max-height: 48px;
    margin-top: 12px;
    padding: 8px 4px;
    opacity: 1;
}

.ishield-card-status.error {
    color: var(--ishield-error);
}

.ishield-card-status.success {
    color: var(--ishield-success);
}

.ishield-card-status svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Secure payment footer */
.ishield-secure-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, var(--ishield-surface-elevated) 0%, rgba(201, 168, 108, 0.03) 100%);
    border-radius: var(--ishield-radius);
    border: 1px solid var(--ishield-border);
}

.ishield-secure-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--ishield-font-body);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--ishield-text-secondary);
}

.ishield-secure-badge svg {
    width: 16px;
    height: 16px;
    color: var(--ishield-success);
}

.ishield-secure-divider {
    width: 1px;
    height: 16px;
    background: var(--ishield-border);
}

.ishield-encryption-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--ishield-font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ishield-text-muted);
}

.ishield-encryption-badge svg {
    width: 14px;
    height: 14px;
}

/* Processing state */
.ishield-card-wrapper.processing {
    pointer-events: none;
}

.ishield-card-wrapper.processing::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    z-index: 10;
}

form.checkout.processing .ishield-card-wrapper {
    opacity: 0.7;
    pointer-events: none;
}

/* Test mode banner */
.ishield-testmode-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fef3cd 0%, #fff8e1 100%);
    border: 1px solid #f0d78c;
    border-radius: var(--ishield-radius-sm);
    font-family: var(--ishield-font-body);
    font-size: 13px;
    font-weight: 500;
    color: #856404;
}

.ishield-testmode-banner svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Loading shimmer animation */
@keyframes ishield-shimmer {
    0% {
        background-position: -400px 0;
    }
    100% {
        background-position: 400px 0;
    }
}

.ishield-loading {
    position: relative;
    overflow: hidden;
}

.ishield-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    background-size: 400px 100%;
    animation: ishield-shimmer 1.5s infinite linear;
}

/* Pulse animation for card detection */
@keyframes ishield-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 var(--ishield-accent-glow);
    }
    50% {
        box-shadow: 0 0 0 8px transparent;
    }
}

.ishield-card-brand.pulse {
    animation: ishield-pulse 0.6s var(--ishield-transition);
}

/* Responsive styles */
@media (max-width: 480px) {
    .ishield-card-row {
        min-height: 56px;
        padding: 0 16px;
    }

    .ishield-card-row-half {
        min-height: 56px;
        padding: 0 16px;
    }

    .ishield-card-input {
        font-size: 16px !important; /* Prevent iOS zoom */
    }

    .ishield-card-brand {
        width: 40px;
        min-width: 40px;
        height: 28px;
        margin-right: 12px;
    }

    .ishield-card-brand svg {
        width: 20px;
        height: 20px;
    }

    .ishield-card-brand img {
        width: 30px;
        height: 20px;
    }

    .ishield-secure-footer {
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }

    .ishield-secure-divider {
        display: none;
    }
}

/* High contrast / accessibility */
@media (prefers-contrast: high) {
    .ishield-card-wrapper {
        border-width: 2px;
    }

    .ishield-card-input {
        font-weight: 600 !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ishield-payment-form,
    .ishield-card-wrapper,
    .ishield-card-brand,
    .ishield-card-input,
    .ishield-card-label,
    .ishield-card-status {
        animation: none !important;
        transition: none !important;
    }
}

/* Dark mode support (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .ishield-payment-form[data-theme="auto"] {
        --ishield-primary: #f5f5f5;
        --ishield-surface: #1a1a1a;
        --ishield-surface-elevated: #242424;
        --ishield-border: #333;
        --ishield-text: #f5f5f5;
        --ishield-text-secondary: #a0a0a0;
        --ishield-text-muted: #707070;
    }
}
