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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 2.5em;
    color: #2d3748;
    margin-bottom: 10px;
}

.subtitle {
    color: #718096;
    font-size: 1.2em;
}

.book-info {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.book-cover img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.book-details h2 {
    color: #2d3748;
    margin-bottom: 20px;
}

.book-details ul {
    margin: 20px 0;
    padding-left: 20px;
}

.book-details li {
    margin: 10px 0;
    color: #4a5568;
}

.price-tag {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
}

.price {
    font-size: 2.5em;
    color: #e53e3e;
    font-weight: bold;
}

.format {
    background: #edf2f7;
    padding: 5px 15px;
    border-radius: 20px;
    color: #4a5568;
}

.purchase-section {
    background: #f7fafc;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
}

.purchase-section h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

#purchaseForm {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

#email {
    flex: 1;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
}

#email:focus {
    outline: none;
    border-color: #667eea;
}

#buyButton {
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

#buyButton:hover {
    transform: translateY(-2px);
}

#buyButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 20px auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.modal-buttons {
    margin-top: 30px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-buttons button {
    padding: 10px 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#refreshButton {
    background: #4299e1;
    color: white;
}

#cancelButton {
    background: #e2e8f0;
    color: #4a5568;
}

.session-id {
    font-size: 12px;
    color: #718096;
    margin-top: 10px;
}

/* Success Page */
.success-page {
    text-align: center;
    padding: 60px 40px;
}

.success-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.success-page h1 {
    color: #48bb78;
    margin-bottom: 20px;
}

.email-display {
    background: #f0fff4;
    padding: 10px 20px;
    border-radius: 5px;
    margin: 20px 0;
    color: #22543d;
}

.next-steps {
    background: #f7fafc;
    padding: 30px;
    border-radius: 10px;
    margin: 30px 0;
    text-align: left;
}

.next-steps h3 {
    margin-bottom: 15px;
    color: #2d3748;
}

.next-steps ol {
    padding-left: 20px;
}

.next-steps li {
    margin: 10px 0;
    color: #4a5568;
}

.back-button {
    display: inline-block;
    padding: 12px 30px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 20px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .book-info {
        grid-template-columns: 1fr;
    }
    
    #purchaseForm {
        flex-direction: column;
    }
    
    #buyButton {
        width: 100%;
    }
}