/* ═══════════════════════════════════════════════
 * Resto Devis Stripe — Shortcode CSS (Front-office)
 * ═══════════════════════════════════════════════ */

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

/* ── Wrapper ─────────────────────────────────── */
.rds-form-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Card ────────────────────────────────────── */
.rds-form-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.06),
        0 10px 15px -3px rgba(0, 0, 0, 0.08),
        0 20px 40px -4px rgba(0, 0, 0, 0.04);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle gradient top accent */
.rds-form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #7c3aed, #2563eb);
    background-size: 200% 100%;
    animation: rds-gradient-shift 3s ease infinite;
}

@keyframes rds-gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* ── Icon ────────────────────────────────────── */
.rds-form-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
}
.rds-form-icon svg {
    width: 32px;
    height: 32px;
}

/* ── Typography ──────────────────────────────── */
.rds-form-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}
.rds-form-subtitle {
    font-size: 15px;
    color: #64748b;
    margin: 0 0 32px;
    line-height: 1.5;
}

/* ── Input Group ─────────────────────────────── */
.rds-input-group {
    text-align: left;
    margin-bottom: 20px;
}
.rds-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.rds-form #rds-code-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace;
    letter-spacing: 2px;
    color: #1e293b;
    text-align: center;
    text-transform: uppercase;
    background: #f8fafc;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.rds-form #rds-code-input:focus {
    outline: none;
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.rds-form #rds-code-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
    letter-spacing: 1px;
    font-size: 14px;
}

/* ── Error ───────────────────────────────────── */
.rds-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: left;
    animation: rds-shake 0.4s ease;
}

@keyframes rds-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}

/* ── Button ──────────────────────────────────── */
.rds-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.rds-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.rds-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.rds-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ── Spinner ─────────────────────────────────── */
.rds-spinner {
    width: 20px;
    height: 20px;
    animation: rds-spin 0.8s linear infinite;
}

@keyframes rds-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Secure Badge ────────────────────────────── */
.rds-secure-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    font-size: 12px;
    color: #94a3b8;
    letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════
 * SUCCESS & CANCEL — Result pages
 * ═══════════════════════════════════════════════ */

/* ── Result Card overrides ───────────────────── */
.rds-result-card {
    max-width: 520px;
}
.rds-result-success::before {
    background: linear-gradient(90deg, #10b981, #34d399, #10b981);
    background-size: 200% 100%;
    animation: rds-gradient-shift 3s ease infinite;
}
.rds-result-cancel::before {
    background: linear-gradient(90deg, #ef4444, #f97316, #ef4444);
    background-size: 200% 100%;
    animation: rds-gradient-shift 3s ease infinite;
}

/* ── Result Icon ─────────────────────────────── */
.rds-result-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rds-icon-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.rds-result-icon svg {
    width: 40px;
    height: 40px;
}

.rds-result-icon-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.08), 0 0 0 16px rgba(16, 185, 129, 0.04);
}
.rds-result-icon-cancel {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #dc2626;
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.08), 0 0 0 16px rgba(239, 68, 68, 0.04);
}

@keyframes rds-icon-pop {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* ── Success checkmark stroke animation ──────── */
.rds-result-icon-success svg path {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: rds-check-draw 0.6s 0.3s ease forwards;
}

@keyframes rds-check-draw {
    to { stroke-dashoffset: 0; }
}

/* ── Cancel X stroke animation ───────────────── */
.rds-result-icon-cancel svg line {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    animation: rds-x-draw 0.4s 0.3s ease forwards;
}
.rds-result-icon-cancel svg line:nth-child(2) {
    animation-delay: 0.45s;
}

@keyframes rds-x-draw {
    to { stroke-dashoffset: 0; }
}

/* ── Result Details (success page) ───────────── */
.rds-result-details {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.rds-result-detail-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #166534;
    text-align: left;
}
.rds-result-detail-row svg {
    flex-shrink: 0;
    color: #16a34a;
}

/* ── Result Buttons ──────────────────────────── */
.rds-result-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rds-btn-success-back {
    display: inline-block;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.rds-btn-success-back:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    color: #ffffff;
}

.rds-btn-retry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.rds-btn-retry:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    color: #ffffff;
}

.rds-btn-cancel-back {
    display: inline-block;
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    color: #64748b;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.rds-btn-cancel-back:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

/* ── Confettis ───────────────────────────────── */
.rds-confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}
.rds-confetti span {
    position: absolute;
    top: -10px;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    opacity: 0;
    animation: rds-confetti-fall 2.5s ease-out forwards;
}
.rds-confetti span:nth-child(1) { left: 10%; background: #10b981; animation-delay: 0.1s; }
.rds-confetti span:nth-child(2) { left: 25%; background: #f59e0b; animation-delay: 0.25s; width: 6px; height: 10px; }
.rds-confetti span:nth-child(3) { left: 40%; background: #3b82f6; animation-delay: 0.4s; }
.rds-confetti span:nth-child(4) { left: 55%; background: #ec4899; animation-delay: 0.15s; width: 10px; height: 6px; }
.rds-confetti span:nth-child(5) { left: 70%; background: #8b5cf6; animation-delay: 0.35s; }
.rds-confetti span:nth-child(6) { left: 85%; background: #f59e0b; animation-delay: 0.5s; width: 6px; height: 8px; }
.rds-confetti span:nth-child(7) { left: 15%; background: #ef4444; animation-delay: 0.6s; }
.rds-confetti span:nth-child(8) { left: 65%; background: #14b8a6; animation-delay: 0.3s; width: 7px; height: 7px; }

@keyframes rds-confetti-fall {
    0%   { top: -10px; opacity: 1; transform: rotate(0deg) translateX(0); }
    25%  { opacity: 1; }
    100% { top: 110%; opacity: 0; transform: rotate(720deg) translateX(40px); }
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 540px) {
    .rds-form-card {
        padding: 36px 24px;
        border-radius: 12px;
    }
    .rds-form-title {
        font-size: 20px;
    }
    .rds-form #rds-code-input {
        font-size: 16px;
    }
    .rds-result-icon {
        width: 64px;
        height: 64px;
    }
    .rds-result-icon svg {
        width: 32px;
        height: 32px;
    }
}
