body {
    font-family: 'Roboto', sans-serif;
    background-color: #f4f7f6;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.container {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 350px;
}

header {
    text-align: center;
    margin-bottom: 25px;
}

header h1 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

header p {
    color: #777;
    margin: 5px 0 0;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; /* Important for padding */
    font-size: 16px;
}

input:focus {
    border-color: #007bff;
    outline: none;
}

input.invalid {
    border-color: #dc3545;
}

input.invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.card-details {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #eee;
    margin-bottom: 20px;
}

.card-details h3 {
    margin-top: 0;
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.row {
    display: flex;
    justify-content: space-between;
}

.half {
    width: 48%;
}

button {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #9ec5fe;
    cursor: not-allowed;
}

.hidden {
    display: none;
}

.spinner {
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#message {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Error messages */
.error-message {
    display: block;
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    min-height: 18px;
}

/* Card number wrapper with brand icon */
.card-number-wrapper {
    position: relative;
}

.card-number-wrapper input {
    padding-right: 50px;
}

.card-brand {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 22px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.card-brand.visa,
.card-brand.mastercard,
.card-brand.amex,
.card-brand.discover,
.card-brand.diners,
.card-brand.jcb {
    opacity: 1;
}

/* Card brand icons using CSS gradients and shapes */
.card-brand.visa {
    background: linear-gradient(135deg, #1a1f71 0%, #0057a0 100%);
    border-radius: 3px;
}

.card-brand.visa::after {
    content: 'VISA';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
}

.card-brand.mastercard {
    background: linear-gradient(90deg, #eb001b 50%, #f79e1b 50%);
    border-radius: 50%;
}

.card-brand.amex {
    background: linear-gradient(135deg, #006fcf 0%, #0077cc 100%);
    border-radius: 3px;
}

.card-brand.amex::after {
    content: 'AMEX';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 8px;
    font-weight: bold;
}

.card-brand.discover {
    background: linear-gradient(135deg, #ff6000 0%, #ff8800 100%);
    border-radius: 3px;
}

.card-brand.diners {
    background: linear-gradient(135deg, #0079be 0%, #00a0e2 100%);
    border-radius: 3px;
}

.card-brand.jcb {
    background: linear-gradient(135deg, #0e4c96 0%, #1273ba 100%);
    border-radius: 3px;
}
