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

:root {
    --primary: #0f172a;
    --success: #10b981;
    --danger: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --background: #f1f5f9;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

/* Card Styles */
.login-card,
.payment-card,
.result-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow);
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.card-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.card-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* Form Styles */
.login-form,
.payment-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--card-bg);
    color: var(--text-primary);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.1);
}

input::placeholder {
    color: #9ca3af;
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: white;
}

.btn-primary {
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: #f3f4f6;
    color: var(--text-primary);
}

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

.btn-success {
    background: var(--success);
    flex: 1;
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(17, 153, 142, 0.5);
}

.btn-danger {
    background: var(--danger);
    flex: 1;
    box-shadow: 0 4px 12px rgba(235, 51, 73, 0.4);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(235, 51, 73, 0.5);
}

.btn:active {
    transform: translateY(0);
}

/* Loading State */
.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    display: none;
}

.btn.loading .spinner {
    display: block;
}

.btn.loading svg {
    display: none;
}

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

/* Inline Errors */
.input-wrapper.error input {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.input-wrapper.error .input-icon path,
.input-wrapper.error .input-icon line,
.input-wrapper.error .input-icon rect {
    stroke: #ef4444;
    fill: #ef4444;
}

.input-wrapper.error .input-icon rect {
    fill: none;
}

.error-message {
    color: #ef4444;
    font-size: 12px;
    margin-top: 6px;
    margin-left: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Footer */
.form-footer {
    text-align: center;
    margin-top: 8px;
}

.link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.link:hover {
    text-decoration: underline;
}

/* Payment Page Specific */
.amount-display {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 32px;
}

.amount-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.amount-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.amount-value input {
    font-size: 36px;
    font-weight: 700;
    background: transparent;
    border: none;
    padding: 0;
    text-align: right;
    width: auto;
    max-width: 200px;
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
}

.amount-value input:focus {
    outline: none;
    box-shadow: none;
}

.currency {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
}

/* Credit Card Preview */
.card-preview {
    margin-bottom: 32px;
    perspective: 1000px;
}

.credit-card {
    background: #1e293b;
    border-radius: 16px;
    padding: 24px;
    color: white;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.credit-card:hover {
    transform: rotateY(5deg) rotateX(5deg);
}

.credit-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.card-chip {
    width: 50px;
    height: 40px;
    background: linear-gradient(135deg, #f7b733 0%, #fc4a1a 100%);
    border-radius: 8px;
    margin-bottom: 24px;
    position: relative;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.card-chip {
    margin-bottom: 0;
}

.card-type-icon {
    height: 40px;
    display: flex;
    align-items: center;
}

.card-type-icon svg {
    height: 100%;
    width: auto;
}

.card-chip::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
}

.card-number {
    font-size: 22px;
    letter-spacing: 3px;
    margin-bottom: 20px;
    font-weight: 500;
}

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

.card-holder,
.card-expiry {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-details .label {
    font-size: 10px;
    text-transform: uppercase;
    opacity: 0.7;
    letter-spacing: 1px;
}

.card-details .value {
    font-size: 14px;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* Result Pages */
.result-card {
    text-align: center;
}

.result-icon {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.checkmark,
.crossmark {
    width: 80px;
    height: 80px;
}

.checkmark-circle,
.crossmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--success);
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: var(--success);
    stroke-width: 3;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

.crossmark-circle {
    stroke: var(--danger);
}

.crossmark-cross {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: var(--danger);
    stroke-width: 3;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

.result-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.result-message {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

/* Transaction Details */
.transaction-details {
    background: var(--background);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.detail-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.amount-highlight {
    font-size: 18px;
    color: var(--primary);
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    background-clip: initial;
    font-weight: 700;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.success-badge {
    background: #d1fae5;
    color: #065f46;
}

.error-badge {
    background: #fee2e2;
    color: #991b1b;
}

/* Error Details */
.error-details {
    background: #fef2f2;
}

.error-suggestions {
    background: var(--background);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    text-align: left;
}

.error-suggestions h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.error-suggestions ul {
    list-style: none;
    padding: 0;
}

.error-suggestions li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-secondary);
    font-size: 14px;
}

.error-suggestions li::before {
    content: '•';
    position: absolute;
    left: 8px;
    color: var(--primary);
    font-weight: bold;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.result-footer {
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.result-footer p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 480px) {
    .login-card,
    .payment-card,
    .result-card {
        padding: 28px;
        border-radius: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .card-header h1 {
        font-size: 24px;
    }
    
    .result-title {
        font-size: 26px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .result-actions {
        display: none;
    }
}
