:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg: #f3f4f6;
    --card-bg: #1e293b;
    --text: #1f2937;
    --text-light: #6b7280;
    --white: #ffffff;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: var(--white);
    border-radius: 16px;
    padding: 35px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
}

/* Header */
.header {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-size: 1.3rem;
    font-weight: 700;
}

.logo svg {
    stroke: var(--primary);
}

.history-btn {
    background: #f3f4f6;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-btn:hover {
    background: #e5e7eb;
}

.history-btn svg {
    stroke: var(--text-light);
}

h1 {
    text-align: center;
    color: var(--text);
    margin-bottom: 15px;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Badges de confiance */
.trust-badges {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 25px;
}

.trust-badges .badge {
    color: var(--text-light);
    font-size: 0.7rem;
    font-weight: 500;
}

/* Carte de crédit visuelle */
.card-container {
    perspective: 1000px;
    margin-bottom: 30px;
    height: 200px;
}

.credit-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.credit-card.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    backface-visibility: hidden;
    padding: 20px;
    color: var(--white);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-back {
    transform: rotateY(180deg);
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-type {
    height: 35px;
    margin-bottom: 20px;
}

.card-type img {
    height: 100%;
    display: none;
}

.card-type img.visible {
    display: block;
}

.card-number {
    font-size: 1.3rem;
    letter-spacing: 2px;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
}

.card-info {
    display: flex;
    justify-content: space-between;
}

.card-info .label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 5px;
}

.card-holder span:last-child,
.card-expiry span:last-child {
    font-size: 0.9rem;
    text-transform: uppercase;
}

.magnetic-strip {
    background: #0f172a;
    height: 45px;
    width: 100%;
}

.cvv-strip {
    background: var(--white);
    height: 35px;
    margin: 15px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 15px;
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    border-radius: 4px;
}

/* Formulaire */
.payment-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input, .currency-select {
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: #f9fafb;
}

.currency-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.form-group input::placeholder {
    color: #9ca3af;
}

.form-group input:focus, .currency-select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input.valid {
    border-color: var(--success);
}

.form-group input.invalid {
    border-color: var(--error);
}

.error-message {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 5px;
    min-height: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
}

.form-row .form-group {
    min-width: 0;
}

.form-row .form-group input {
    width: 100%;
}

.amount-group .amount-input {
    position: relative;
}

.amount-group input {
    width: 100%;
    padding-right: 40px;
}

.amount-group .currency {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-weight: 600;
}

/* Checkbox */
.checkbox-group {
    margin-top: -10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-light);
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 4px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkbox-label input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
}

/* Bouton */
.pay-button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    margin-top: 10px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.pay-button:hover {
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
    transform: translateY(-1px);
}

.pay-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.pay-button .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.pay-button.loading .button-text {
    display: none;
}

.pay-button.loading .spinner {
    display: inline-block;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.result-icon.success {
    background: #d1fae5;
    color: var(--success);
}

.result-icon.error {
    background: #fee2e2;
    color: var(--error);
}

.modal-content h2 {
    color: var(--text);
    margin-bottom: 10px;
}

.modal-content p {
    color: var(--text-light);
    margin-bottom: 25px;
}

.close-button {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s;
}

.close-button:hover {
    background: var(--primary-dark);
}

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

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.85rem;
}

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

.receipt-row span {
    color: var(--text-light);
}

.receipt-row strong {
    color: var(--text);
}

/* Support Box */
.support-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.support-text {
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.support-number {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.support-number svg {
    stroke: var(--primary);
}

.support-number strong {
    font-size: 1.2rem;
    color: var(--primary);
    letter-spacing: 1px;
}

.support-hours {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Countdown */
.countdown-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 25px 0;
}

.countdown-ring-container {
    position: relative;
    width: 90px;
    height: 90px;
}

.countdown-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.countdown-track {
    fill: none;
    stroke: #fee2e2;
    stroke-width: 4;
}

.countdown-arc {
    fill: none;
    stroke: var(--error);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.countdown-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--error);
    font-variant-numeric: tabular-nums;
}

.validation-message {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 12px;
}

.retry-button {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.retry-button:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.secure-info-sub {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-bottom: 15px;
    font-style: italic;
}

/* SMS Animation */
.sms-animation {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.sms-animation.show {
    display: flex;
}

.sms-content {
    text-align: center;
    color: white;
}

.phone-icon {
    animation: vibrate 0.3s linear infinite;
    margin-bottom: 20px;
}

.phone-icon svg {
    stroke: white;
}

@keyframes vibrate {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.sms-dots span {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    margin: 0 5px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.sms-dots span:nth-child(1) { animation-delay: -0.32s; }
.sms-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 3D Secure Modal */
.secure-content {
    text-align: center;
}

.secure-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.secure-header h2 {
    margin-top: 10px;
    color: var(--text);
}

.secure-info {
    color: var(--text-light);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    color: var(--text-light);
}

#codeTimer {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary);
}

#codeTimer.expired {
    color: var(--error);
}

.secure-code-display {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.secure-code-display strong {
    color: var(--success);
    font-size: 1.3rem;
    letter-spacing: 3px;
}

.secure-content .form-group {
    margin-bottom: 10px;
}

.secure-content .form-group input {
    text-align: center;
    font-size: 1.2rem;
    letter-spacing: 5px;
}

.attempts-info {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.attempts-info.warning {
    color: var(--warning);
    font-weight: 600;
}

.attempts-info.blocked {
    color: var(--error);
    font-weight: 600;
}

.secure-content .pay-button {
    width: 100%;
    margin-bottom: 10px;
    margin-top: 0;
}

.resend-button {
    background: transparent;
    color: var(--primary);
    border: none;
    padding: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.resend-button:hover:not(.disabled) {
    text-decoration: underline;
}

.resend-button.disabled {
    color: var(--text-light);
    cursor: not-allowed;
}

.cancel-button {
    background: transparent;
    color: var(--text-light);
    border: 1px solid #e5e7eb;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.cancel-button:hover {
    background: #f3f4f6;
}

/* History Panel */
.history-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    background: var(--white);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 150;
    display: flex;
    flex-direction: column;
}

.history-panel.show {
    right: 0;
}

.history-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    color: var(--text);
    font-size: 1.1rem;
}

.close-history {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.no-history {
    text-align: center;
    color: var(--text-light);
    padding: 40px 20px;
}

.history-item {
    background: #f9fafb;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid var(--success);
}

.history-item.failed {
    border-left-color: var(--error);
}

.history-main {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.history-amount {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.history-card {
    color: var(--text-light);
    font-size: 0.9rem;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-light);
}

.history-status {
    font-weight: 600;
}

.history-item.success .history-status {
    color: var(--success);
}

.history-item.failed .history-status {
    color: var(--error);
}

/* Footer */
.footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.secure-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.secure-footer svg {
    stroke: var(--success);
}

.payment-methods {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.payment-methods span {
    font-size: 0.7rem;
    color: #9ca3af;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 25px;
    }
    
    .card-number {
        font-size: 1.1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .history-panel {
        width: 100%;
        right: -100%;
    }
}
