:root {
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --color-text: #1f2937;
    --color-muted: #666;
    --color-border: #e1e4e8;
    --color-border-light: #e0e0e0;
    --color-card-bg: #ffffff;
    --gradient-purple: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-blue: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --background-neutral: #f6f7fb;
    --placeholder-color: rgba(156, 163, 175, 0.7);
}

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

body.page {
    font-family: var(--font-sans);
    background: var(--gradient-purple);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--color-text);
}

body.theme-blue {
    background: var(--gradient-blue);
}

body.theme-neutral {
    background: var(--background-neutral);
    display: block;
    padding: 40px 16px;
}

.page-card,
.container {
    background: var(--color-card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 600px;
}

.activate-page .page-card,
.activate-page .container {
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.mock-page .page-card,
.mock-page .container {
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    padding: 28px;
}

body.theme-neutral .page-card,
body.theme-neutral .container {
    margin: 6vh auto;
    max-width: 520px;
}

label.required::after {
    content: ' *';
    color: #e02424;
    font-weight: 700;
}

h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--color-muted);
    font-size: 16px;
    margin-bottom: 30px;
}

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

label {
    display: block;
    color: #555;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

input,
select,
textarea,
button {
    font-family: inherit;
}

input[type="text"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 16px;
    background-color: #fff;
    color: var(--color-text);
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.activate-page input[type="text"]:focus {
    border-color: #2a5298;
    box-shadow: none;
}

input::placeholder,
input::-webkit-input-placeholder,
input::-moz-placeholder,
input:-ms-input-placeholder,
input::-ms-input-placeholder,
textarea::placeholder {
    color: var(--placeholder-color) !important;
    -webkit-text-fill-color: var(--placeholder-color) !important;
    opacity: 1;
}

input[type="text"]::placeholder,
input[type="text"]::-webkit-input-placeholder,
input[type="text"]::-moz-placeholder,
input[type="text"]:-ms-input-placeholder,
input[type="text"]::-ms-input-placeholder,
input[type="email"]::placeholder,
input[type="email"]::-webkit-input-placeholder,
input[type="email"]::-moz-placeholder,
input[type="email"]:-ms-input-placeholder,
input[type="email"]::-ms-input-placeholder {
    color: var(--placeholder-color) !important;
    -webkit-text-fill-color: var(--placeholder-color) !important;
}
@media (forced-colors: active) {
    input::placeholder,
    input::-webkit-input-placeholder,
    input::-moz-placeholder,
    input:-ms-input-placeholder,
    input::-ms-input-placeholder,
    textarea::placeholder {
        color: GrayText !important;
    }
}

.help-text {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 4px;
}

button,
.btn {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

button:disabled,
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Purchase page */
.purchase-page .logo {
    text-align: center;
    margin-bottom: 30px;
}

.purchase-page h1 {
    text-align: center;
}

.purchase-page .subtitle {
    text-align: center;
}

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

.purchase-page .purchase-button {
    width: 100%;
    background: #6366f1;
    color: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 16px;
    border: 0;
}

.purchase-page .purchase-button:hover:not(:disabled) {
    background: #4f46e5;
}

.error-message {
    display: none;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
}

.secure-badge {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--color-muted);
}

.secure-badge svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 5px;
}

/* Unified Product Picker Container */
.product-picker-container {
    border: 2px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.product-picker-container select {
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--color-border);
    margin: 0;
}

.product-picker-container select:focus {
    box-shadow: inset 0 0 0 2px rgba(102, 126, 234, 0.3);
    border-color: var(--color-border);
}

.product-summary {
    background: #f8f9ff;
    padding: 16px;
    margin: 0;
    border-radius: 0;
    border: none;
    display: none;
}

.product-summary .ps-content {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.product-summary .ps-image {
    width: 256px;
    height: 256px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    background: #fff;
}

.product-summary .ps-details {
    flex: 1;
    min-width: 0;
}

.product-summary .ps-description {
    color: #333;
    font-size: 14px;
    margin-bottom: 6px;
    line-height: 1.4;
}

.product-summary .ps-sku {
    color: var(--color-muted);
    font-size: 11px;
    margin-bottom: 10px;
}

.product-summary .ps-pricing {
    margin-bottom: 8px;
}

.product-summary .ps-price {
    font-weight: 700;
    color: #111;
    font-size: 22px;
}

.product-summary .ps-renewal-price {
    color: #047857;
    font-size: 12px;
    margin-top: 2px;
    display: none;
}

.product-summary .ps-meta {
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.product-summary .ps-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-summary .ps-features li {
    color: #444;
    font-size: 13px;
    padding: 2px 0;
    padding-left: 16px;
    position: relative;
}

.product-summary .ps-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #047857;
    font-weight: bold;
}

@media (max-width: 500px) {
    .product-summary .ps-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .product-summary .ps-features li {
        text-align: left;
    }
}

.license-options {
    display: none;
}

/* Activate page */
.activate-page h1 {
    color: #1e3c72;
    text-align: center;
}

.activate-page .subtitle {
    text-align: center;
}

.activate-page label {
    font-weight: 600;
    color: #444;
}

.btn {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #2a5298;
    color: #fff;
    margin-bottom: 15px;
}

.btn-primary:hover:not(:disabled) {
    background: #1e3c72;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.3);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.btn-transfer {
    background: #ff8c00;
    color: #fff;
    margin-bottom: 15px;
}

.btn-transfer:hover {
    background: #ff7700;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-disabled {
    background: #ccc !important;
    color: #666 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-disabled:hover {
    background: #ccc !important;
    transform: none !important;
    box-shadow: none !important;
}

.divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

.divider span {
    background: #fff;
    padding: 0 20px;
    position: relative;
    color: var(--color-muted);
    font-size: 14px;
}

.purchase-section {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

.purchase-section h3 {
    color: #444;
    margin-bottom: 10px;
    font-size: 18px;
}

.purchase-section p {
    color: var(--color-muted);
    margin-bottom: 15px;
    font-size: 14px;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    font-weight: 500;
    line-height: 1.5;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.device-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.device-info strong {
    color: #444;
}

.loading {
    display: none;
    text-align: center;
    margin: 20px 0;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2a5298;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.transfer-section {
    display: none;
    background: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #ffeeba;
}

.transfer-section h3,
.transfer-section p {
    color: #856404;
    margin-bottom: 10px;
}

/* Success page */
.success-page .success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #4ade80;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.success-page .checkmark {
    width: 40px;
    height: 40px;
    stroke: #fff;
    stroke-width: 3;
    fill: none;
    animation: drawCheck 0.5s ease-out 0.3s forwards;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

.status-box {
    background: #f8f9ff;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.status-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.status-message {
    color: var(--color-muted);
    font-size: 14px;
    line-height: 1.5;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #667eea;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
    margin-left: 10px;
}

.license-details {
    background: #f8f9ff;
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
    display: none;
}

.license-details h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

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

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

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

.detail-value {
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.license-key {
    font-family: 'Courier New', monospace;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
}

.error-box {
    background: #fee;
    border: 2px solid #fcc;
    color: #c33;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    display: none;
}

.support-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

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

/* Mock payment */
.mock-page h1 {
    font-size: 22px;
    margin: 0 0 6px;
    color: #111;
}

.mock-page p {
    color: #555;
    margin: 2px 0 14px;
}

.mock-page .row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

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

.mock-page .label {
    color: #666;
}

.mock-page .value {
    color: #222;
    font-weight: 600;
}

.mock-page .btn {
    background: #6366f1;
    color: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 16px;
    margin-top: 18px;
}

.mock-page .btn:hover:not(:disabled) {
    background: #4f46e5;
}

.mock-page .note {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    text-align: center;
}

.mock-page .error {
    background: #fee;
    border: 1px solid #fcc;
    color: #a33;
    padding: 10px;
    border-radius: 8px;
    margin-top: 12px;
    display: none;
}

/* Responsive */
@media (max-width: 600px) {
    body.theme-neutral {
        padding: 24px 12px;
    }

    .page-card,
    .container {
        padding: 30px 20px;
    }

    .purchase-page .row {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 24px;
    }

    .btn {
        font-size: 16px;
    }
}

.qb-card-container {
    border: 1px solid #dbe2f1;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.qb-card-field {
    min-height: 48px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid transparent;
}

.qb-card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.qb-card-row .qb-card-field {
    flex: 1 1 140px;
}

.mock-card-container {
    border: 1px solid #dbe2f1;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.mock-card-field {
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    font-size: 16px;
    color: #111;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.mock-card-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.mock-card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.mock-card-row .mock-card-field {
    flex: 1 1 140px;
}

.badge.type-personal {
    background: #ecfdf5;
    color: #047857;
}

.badge.type-1day {
    background: #fef3c7;
    color: #92400e;
}

.badge.type-1year {
    background: #eef2ff;
    color: #3730a3;
}

/* Card form styles */
.card-form-container {
    border: 1px solid #dbe2f1;
    border-radius: 10px;
    padding: 16px;
    background: #f8fafc;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.card-field-group {
    margin-bottom: 12px;
}

.card-field-group:last-child {
    margin-bottom: 0;
}

.card-field-group label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
    font-weight: 500;
}

.card-form-container input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    background: #fff;
    color: #111;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card-form-container input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.card-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

@media (max-width: 500px) {
    .card-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .card-row .card-field-group:last-child {
        grid-column: 1 / -1;
    }
}

/* Checkbox group styles */
.checkbox-group {
    margin: 20px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #333;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.checkbox-group .help-text {
    margin-left: 26px;
    margin-top: 4px;
}

/* Loading animation for button */
button .loading,
.btn .loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 8px;
}
