* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
    padding: 20px;
    color: #1e293b;
    line-height: 1.6;
    font-weight: 400;
}

.container {
    max-width: 480px;
    margin: 0 auto;
}

/* ====================== */
/* INVALID CARD POPUP - Professional Auto-Dismiss */
/* ====================== */

.invalid-card-popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #fee;
    border: 2px solid #dc2626;
    border-radius: 8px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

@keyframes popupFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.popup-content {
    background: white;
    border-radius: 10px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid #e0e0e0;
    padding: 20px;
    text-align: center;
    transform: translateY(0);
    opacity: 1;
    transition: all 0.3s ease;
}

.popup-content.fade-out {
    animation: popupFadeOut 0.3s ease forwards;
}

.popup-message {
    color: #333;
    font-size: 15px;
    line-height: 1.4;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    margin: 0;
    padding: 0;
}

/* Status indicator */
.popup-status {
    width: 20px;
    height: 20px;
    margin: 0 auto 12px;
    position: relative;
}

.popup-status::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: #e74c3c;
    border-radius: 50%;
    opacity: 0.8;
}

.popup-status::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 9px;
    width: 2px;
    height: 10px;
    background: white;
    border-radius: 1px;
    transform: rotate(45deg);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .popup-content {
        max-width: 320px;
        padding: 18px;
    }

    .popup-message {
        font-size: 14px;
    }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #f1f5f9;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e40af;
    letter-spacing: -0.02em;
}

.logo i {
    font-size: 1.6rem;
    color: #3b82f6;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #059669;
    font-size: 0.8rem;
    font-weight: 500;
    background: #f0fdf4;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #dcfce7;
}

/* Gift Card */
.gift-card {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: visible;
    border: 1px solid #f1f5f9;
}

/* Section Buttons */
.section-buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 12px;
    background: #f8fafc;
    padding: 8px;
    border-radius: 14px;
}

.section-button {
    flex: 1;
    padding: 16px 12px;
    background: transparent;
    border: none;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    color: #64748b;
    font-size: 0.85rem;
    position: relative;
}

.section-button:hover {
    background: rgba(255, 255, 255, 0.8);
    color: #475569;
    transform: translateY(-1px);
}

.section-button.active {
    background: white;
    color: #1e40af;
    box-shadow: 0 2px 12px rgba(30, 64, 175, 0.15);
    font-weight: 600;
}

.section-button i {
    display: block;
    font-size: 20px;
    margin-bottom: 8px;
    opacity: 0.8;
}

.section-button.active i {
    opacity: 1;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Form Sections */
.form-section {
    display: none;
}

.form-section.active {
    display: block;
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from { 
        opacity: 0; 
        transform: translateY(12px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

h2 {
    color: #1e293b;
    margin-bottom: 8px;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-description {
    color: #64748b;
    margin-bottom: 28px;
    line-height: 1.5;
    font-size: 0.9rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: -0.01em;
}

input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: #1e293b;
    font-family: inherit;
}

input::placeholder {
    color: #94a3b8;
}

input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.input-with-icon {
    position: relative;
}

.card-icons {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
}

.card-icons i {
    font-size: 1.3rem;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.card-icons i.active {
    opacity: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Custom Select Component */
.custom-select-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.custom-select-wrapper {
    position: relative;
}

.custom-select {
    position: relative;
    cursor: pointer;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    color: #475569;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.custom-select-trigger i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    color: #94a3b8;
}

.custom-select.active .custom-select-trigger i {
    transform: rotate(180deg);
}

.custom-select.active .custom-select-trigger {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
    margin-top: 4px;
    scroll-behavior: smooth;
}

.custom-select.active .custom-options {
    display: block;
    animation: fadeInUp 0.2s ease;
}

.custom-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 0.9rem;
    color: #475569;
    font-family: inherit;
}

.custom-option:hover {
    background: #f8fafc;
}

.custom-option.selected {
    background: #eff6ff;
    color: #1e40af;
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    color: white;
    width: 100%;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.96);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #f1f5f9;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: #64748b;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Success Message */
.success-message {
    text-align: center;
    padding: 40px 20px;
    display: none;
}

.success-message.active {
    display: block;
    animation: fadeInUp 0.4s ease;
}

.success-icon {
    font-size: 3rem;
    color: #10b981;
    margin-bottom: 20px;
    background: #f0fdf4;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 2px solid #dcfce7;
}

.success-message h3 {
    color: #1e293b;
    margin-bottom: 12px;
    font-size: 1.3rem;
    font-weight: 700;
}

.success-message p {
    color: #64748b;
    margin-bottom: 0;
    line-height: 1.5;
}

.success-actions {
    margin-top: 28px;
}

/* Error Messages */
.error-message {
    color: #dc2626;
    font-size: 0.78rem;
    margin-top: 6px;
    display: none;
    font-weight: 500;
}

.error-message.active {
    display: block;
}

input.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Security Footer */
.security-footer {
    margin-top: 24px;
    padding: 20px 24px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #f1f5f9;
}

.security-features {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 16px;
}

.security-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 500;
}

.security-item i {
    color: #10b981;
    font-size: 0.9rem;
}

/* Initial Loading Overlay */
.initial-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.initial-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    color: #1e293b;
    max-width: 360px;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
}

.loading-spinner-large {
    width: 52px;
    height: 52px;
    border: 3px solid #f1f5f9;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-content h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.loading-content p {
    font-size: 0.9rem;
    margin-bottom: 20px;
    color: #64748b;
    line-height: 1.5;
}

.security-badge-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #eff6ff;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #1e40af;
    font-weight: 500;
    border: 1px solid #dbeafe;
}

/* Hide card type display */
.card-type-display {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .custom-select-group {
        grid-template-columns: 1fr;
    }
    
    .security-features {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .gift-card {
        padding: 24px;
    }
    
    .section-buttons {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .gift-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .loading-content {
        margin: 20px;
        padding: 32px 24px;
    }
    
    .section-button {
        padding: 14px 10px;
        font-size: 0.8rem;
    }
    
    .section-button i {
        font-size: 18px;
        margin-bottom: 6px;
    }
}

/* Micro-interactions */
input:not(:placeholder-shown) {
    border-color: #cbd5e1;
}

input:valid:not(:placeholder-shown) {
    border-color: #10b981;
}

input:invalid:not(:placeholder-shown) {
    border-color: #dc2626;
}

/* Focus states for accessibility */
.btn:focus-visible,
input:focus-visible,
.custom-select-trigger:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Custom scrollbar for dropdown */
.custom-options::-webkit-scrollbar {
    width: 6px;
}

.custom-options::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 0 10px 10px 0;
}

.custom-options::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.custom-options::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


