/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 40px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

/* Main content */
main {
    flex: 1;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #eee;
    color: #666;
    font-size: 14px;
}

/* Purchase form */
.purchase-form {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.purchase-form h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    text-align: center;
}

.purchase-form .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 13px;
}

/* Payment methods */
.payment-methods {
    display: flex;
    gap: 12px;
}

.payment-option {
    flex: 1;
    cursor: pointer;
}

.payment-option input {
    display: none;
}

.payment-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s;
}

.payment-option input:checked + .payment-label {
    border-color: #007bff;
    background: #f0f7ff;
}

.payment-icon {
    font-size: 20px;
}

/* Price display */
.price-display {
    text-align: center;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 24px 0;
}

.price {
    font-size: 36px;
    font-weight: bold;
    color: #333;
}

.period {
    display: block;
    color: #666;
    margin-top: 4px;
}

/* Features list */
.features-list {
    margin: 20px 0;
}

.features-list h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.features-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.features-list li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: #555;
}

.features-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

/* Submit button */
#checkout-btn {
    width: 100%;
    padding: 16px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#checkout-btn:hover {
    background: #0056b3;
}

#checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.error-message {
    color: #dc3545;
    text-align: center;
    margin-top: 16px;
    min-height: 20px;
}

/* Success page */
.success-page,
.error-page {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    background: white;
    padding: 60px 40px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.success-icon {
    width: 80px;
    height: 80px;
    background: #28a745;
    color: white;
    font-size: 40px;
    line-height: 80px;
    border-radius: 50%;
    margin: 0 auto 24px;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: #dc3545;
    color: white;
    font-size: 40px;
    line-height: 80px;
    border-radius: 50%;
    margin: 0 auto 24px;
}

.success-message {
    font-size: 18px;
    color: #555;
    margin-bottom: 30px;
}

.next-steps {
    text-align: left;
    background: #f8f9fa;
    padding: 24px;
    border-radius: 8px;
    margin: 24px 0;
}

.next-steps h2 {
    margin-top: 0;
    font-size: 18px;
}

.next-steps ol {
    margin: 0;
    padding-left: 24px;
}

.next-steps li {
    margin-bottom: 8px;
}

.order-reference {
    color: #666;
    font-size: 14px;
}

.order-reference code {
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
}

.help-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    color: #666;
    font-size: 14px;
}

.error-details {
    font-size: 18px;
    color: #555;
    margin-bottom: 30px;
}

.error-actions {
    margin: 30px 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #007bff;
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
}

.btn-secondary:hover {
    background: #545b62;
}

/* Admin pages */
.admin-page {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-page h1 {
    margin-top: 0;
}

.admin-page .subtitle {
    color: #666;
    margin-bottom: 20px;
}

.back-link {
    display: inline-block;
    color: #007bff;
    text-decoration: none;
    margin-bottom: 20px;
}

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

/* Tables */
.orders-table,
.email-log-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.orders-table th,
.orders-table td,
.email-log-table th,
.email-log-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.orders-table th,
.email-log-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.orders-table code,
.email-log-table code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* Status badges */
.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-paid {
    background: #d4edda;
    color: #155724;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

.status-refunded {
    background: #e2e3e5;
    color: #383d41;
}

.status-sent {
    background: #d4edda;
    color: #155724;
}

/* Order details */
.order-details {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 8px;
    margin: 20px 0;
}

.order-details dl {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    margin: 0;
}

.order-details dt {
    font-weight: 600;
    color: #666;
}

.order-details dd {
    margin: 0;
}

.order-details code {
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
}

/* Actions */
.actions {
    margin: 20px 0;
}

.actions #resend-status {
    margin-top: 10px;
    font-size: 14px;
}

.actions .success {
    color: #28a745;
}

.actions .error {
    color: #dc3545;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.pagination a {
    color: #007bff;
    text-decoration: none;
}

.pagination a:hover {
    text-decoration: underline;
}

/* Plan selection */
.plan-options {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.plan-option {
    flex: 1;
    cursor: pointer;
}

.plan-option input {
    display: none;
}

.plan-card {
    position: relative;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.2s;
    background: white;
    height: 100%;
}

.plan-option input:checked + .plan-card {
    border-color: #007bff;
    background: #f0f7ff;
}

.plan-option.recommended .plan-card {
    border-color: #007bff;
}

.plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.plan-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.plan-name {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.plan-price {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #007bff;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

.plan-features li {
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    color: #555;
}

.plan-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

.plan-features li strong {
    color: #007bff;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .purchase-form {
        padding: 24px;
    }

    .payment-methods {
        flex-direction: column;
    }

    .plan-options {
        flex-direction: column;
    }

    .order-details dl {
        grid-template-columns: 1fr;
    }

    .order-details dt {
        margin-bottom: 4px;
    }

    .orders-table,
    .email-log-table {
        font-size: 14px;
    }
}
