/* ==================== БАЗОВЫЕ СТИЛИ ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #e8e8e8;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 420px;
}

/* ==================== КРЕДИТНАЯ КАРТА ==================== */
.card-wrapper {
    perspective: 1000px;
    margin-bottom: 24px;
}

.credit-card {
    width: 100%;
    aspect-ratio: 1.586;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(0deg) rotateY(0deg);
    transition: transform 0.15s ease-out;
    will-change: transform;
}

.card-front {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #5fbfbf 0%, #4a9fd4 30%, #5e7fd3 70%, #7b68d4 100%);
    border-radius: 14px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 
        0 15px 35px -10px rgba(0, 0, 0, 0.3),
        0 8px 15px -5px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

/* Блики на карте */
.card-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    pointer-events: none;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5px;
}

.card-logo {
    width: 60px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}



/* Card Logo Switching */
.card-logo {
    position: relative;
    width: 50px;
    height: 32px;
}

.card-logo .logo {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 32px;
    object-fit: contain;
}

.card-logo .logo.active {
    display: block;
}

.card-logo .unknown-logo {
    width: 50px;
    height: 32px;
}

.card-logo .unknown-logo svg {
    width: 100%;
    height: 100%;
}

/* Chip */
.card-chip {
    width: 42px;
    height: 32px;
    margin-bottom: 16px;
}

.chip-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Card Number Section */
.card-number-section {
    margin-bottom: 16px;
}

.card-label {
    font-size: 8px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.card-number {
    font-family: 'Space Mono', monospace;
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: 3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Card Footer */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
}

.card-holder-name {
    font-size: 14px;
    font-weight: 500;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.card-expiry {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ==================== ФОРМА ==================== */
.form-container {
    background: white;
    border-radius: 16px;
    padding: 28px 32px;
    box-shadow: 
        0 10px 40px -10px rgba(0, 0, 0, 0.15),
        0 4px 10px rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    font-weight: 400;
    color: #555;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    background: #dfe6e9;
    border: none;
    border-radius: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
    outline: none;
}

.form-input::placeholder {
    color: #888;
}

.form-input:focus {
    background: #d0d8db;
    box-shadow: 0 0 0 3px rgba(95, 191, 191, 0.2);
}

.form-row {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.form-group.half {
    flex: 1;
}

.expiry-inputs {
    display: flex;
    gap: 12px;
}

.form-input.small {
    flex: 1;
    text-align: center;
}

.cvv-group {
    min-width: 100px;
    flex: 0 0 auto;
}

/* ==================== КНОПКА ==================== */
.submit-btn {
    width: auto;
    padding: 12px 40px;
    background: linear-gradient(135deg, #e74c6f 0%, #d63e5a 100%);
    border: none;
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(231, 76, 111, 0.3);
    margin-top: 8px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 111, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==================== ОШИБКИ ==================== */
.form-input.error {
    background: #fdf0f0;
    box-shadow: 0 0 0 2px #e74c3c;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.error-message::before {
    content: "⚠";
}

/* ==================== УСПЕШНАЯ ГАЛОЧКА НА КНОПКЕ ==================== */
.submit-btn.success-checkmark {
    background: #22c55e !important;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.checkmark-icon {
    width: 24px;
    height: 24px;
}

.checkmark-icon circle {
    stroke: white;
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: checkmark-circle 0.4s ease-in-out forwards;
}

.checkmark-icon path {
    stroke: white;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: checkmark-check 0.3s ease-in-out 0.2s forwards;
}

@keyframes checkmark-circle {
    to { stroke-dashoffset: 0; }
}

@keyframes checkmark-check {
    to { stroke-dashoffset: 0; }
}

/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-dots {
    width: 80px;
    height: 80px;
    position: relative;
}

.loading-dots .dot {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #5fbfbf;
    border-radius: 50%;
    animation: dotFade 1.2s linear infinite;
}

.loading-dots .dot:nth-child(1) { top: 0; left: 35px; animation-delay: 0s; }
.loading-dots .dot:nth-child(2) { top: 7px; left: 52px; animation-delay: 0.1s; }
.loading-dots .dot:nth-child(3) { top: 22px; left: 63px; animation-delay: 0.2s; }
.loading-dots .dot:nth-child(4) { top: 42px; left: 63px; animation-delay: 0.3s; }
.loading-dots .dot:nth-child(5) { top: 57px; left: 52px; animation-delay: 0.4s; }
.loading-dots .dot:nth-child(6) { top: 65px; left: 35px; animation-delay: 0.5s; }
.loading-dots .dot:nth-child(7) { top: 57px; left: 18px; animation-delay: 0.6s; }
.loading-dots .dot:nth-child(8) { top: 42px; left: 7px; animation-delay: 0.7s; }
.loading-dots .dot:nth-child(9) { top: 22px; left: 7px; animation-delay: 0.8s; }
.loading-dots .dot:nth-child(10) { top: 7px; left: 18px; animation-delay: 0.9s; }

@keyframes dotFade {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

/* ==================== SUCCESS PAGE ==================== */
.success-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5fbfbf 0%, #4a9fd4 30%, #5e7fd3 70%, #7b68d4 100%);
    padding: 20px;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 9999;
}

.success-container {
    background: white;
    border-radius: 24px;
    padding: 48px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.success-icon-wrapper {
    margin-bottom: 24px;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.success-icon svg {
    width: 100%;
    height: 100%;
}

.success-circle {
    stroke: #22c55e;
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: circle 0.6s ease-in-out forwards;
}

.success-check {
    stroke: #22c55e;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: check 0.3s ease-in-out 0.4s forwards;
}

@keyframes circle {
    to { stroke-dashoffset: 0; }
}

@keyframes check {
    to { stroke-dashoffset: 0; }
}

.success-title {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.success-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0 0 32px 0;
}

.success-details {
    background: #f9fafb;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.success-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.success-row:first-child {
    padding-top: 0;
}

.success-row:last-child {
    padding-bottom: 0;
}

.success-label {
    font-size: 14px;
    color: #6b7280;
}

.success-value {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.success-amount {
    font-size: 20px;
    color: #22c55e;
}

.success-txn {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    background: #e5e7eb;
    padding: 4px 8px;
    border-radius: 6px;
}

.success-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 0;
}

.success-message {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.success-message.processing {
    background: #fef3c7;
    border-color: #fbbf24;
}

.processing-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.success-message p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #92400e;
}

.success-message p:last-child {
    margin-bottom: 0;
}

.success-footer {
    color: #6b7280;
    font-size: 14px;
}

.success-footer p {
    margin: 0;
}

/* ==================== АДАПТИВ ==================== */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }
    
    .container {
        max-width: 100%;
    }
    
    .card-front {
        padding: 18px;
    }
    
    .card-number {
        font-size: 18px;
        letter-spacing: 2px;
    }
    
    .card-holder-name,
    .card-expiry {
        font-size: 14px;
    }
    
    .form-container {
        padding: 24px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .cvv-group {
        max-width: 100%;
    }
    
    .submit-btn {
        width: 100%;
    }
    
    .success-container {
        padding: 32px 24px;
    }
    
    .success-title {
        font-size: 24px;
    }
}

/* ==================== MODAL ERROR ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    font-weight: bold;
}

.error-modal .modal-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
}

.modal-content h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.modal-content p {
    color: #7f8c8d;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 25px;
}

.modal-button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    border: none;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}
