/* ========== CSS Variables ========== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --accent: #8e44ad;
    --accent-hover: #9b59b6;
    --accent-glow: rgba(142, 68, 173, 0.3);
    --success: #27ae60;
    --success-bg: rgba(39, 174, 96, 0.1);
    --warning: #f39c12;
    --warning-bg: rgba(243, 156, 18, 0.1);
    --error: #e74c3c;
    --error-bg: rgba(231, 76, 60, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --border: #2a2a3a;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ========== Container ========== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
}

/* ========== Hero Section ========== */
.hero {
    text-align: center;
    margin-bottom: 48px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent) 0%, #6c3483 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* ========== Features Section ========== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 48px;
}

.feature {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: transform var(--transition), box-shadow var(--transition);
}

.feature:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 12px;
}

.feature h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ========== License Section ========== */
.license-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
}

.license-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 32px;
}

/* ========== Input Group ========== */
.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    max-width: 320px;
    padding: 16px 20px;
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.input-group input::placeholder {
    color: var(--text-muted);
    text-transform: uppercase;
}

.input-group input.valid {
    border-color: var(--success);
}

.input-group input.invalid {
    border-color: var(--error);
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ========== Status Display ========== */
.status-display {
    margin-bottom: 24px;
    padding: 16px 24px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.status-display.hidden {
    display: none;
}

.status-display.active {
    background: var(--success-bg);
    border: 1px solid var(--success);
}

.status-display.inactive {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
}

.status-display.error {
    background: var(--error-bg);
    border: 1px solid var(--error);
}

.status-display.loading {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.status-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.status-icon {
    font-size: 1.2rem;
}

.status-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.status-display.active .status-text {
    color: var(--success);
}

.status-display.inactive .status-text {
    color: var(--warning);
}

.status-display.error .status-text {
    color: var(--error);
}

/* ========== Buttons ========== */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #6c3483 100%);
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-primary);
    border-color: var(--accent);
}

/* ========== License Info ========== */
.license-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========== Footer ========== */
.footer {
    text-align: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

.footer a:hover {
    color: var(--accent-hover);
}

.footer-links {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }
    
    .hero {
        margin-bottom: 32px;
    }
    
    .header-nav {
        flex-direction: column;
        gap: 16px;
    }
    
    .nav-links {
        gap: 16px;
    }
    
    .nav-links a {
        font-size: 0.85rem;
    }
    
    .logo h1 {
        font-size: 1.6rem;
    }
    
    .tagline {
        font-size: 0.95rem;
    }
    
    .features {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .license-section {
        padding: 20px 16px;
    }
    
    .license-section h2 {
        font-size: 1.3rem;
    }
    
    .input-group input {
        font-size: 1rem;
        padding: 14px 16px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 16px 12px;
    }
    
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .license-section {
        padding: 16px 12px;
    }
    
    .pricing-section h3 {
        font-size: 1.1rem;
    }
    
    .price-amount {
        font-size: 2rem;
    }
    
    .pricing-features li {
        font-size: 0.85rem;
        padding: 6px 0;
    }
    
    .btn-checkout {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}

/* ========== Loading Spinner ========== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(142, 68, 173, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(142, 68, 173, 0); }
    100% { box-shadow: 0 0 0 0 rgba(142, 68, 173, 0); }
}

/* ========== Checkout Modal ========== */
.checkout-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkout-modal.hidden {
    display: none;
}

.checkout-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.checkout-container {
    position: relative;
    width: 95%;
    max-width: 500px;
    height: 90%;
    max-height: 700px;
    background: #fff;
    border-radius: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.checkout-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.checkout-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

#checkout {
    width: 100%;
    height: 100%;
    min-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#checkout iframe {
    width: 100% !important;
    min-height: 500px !important;
}

.checkout-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    color: #666;
    gap: 16px;
}

.checkout-loading .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

@media (max-width: 600px) {
    .checkout-modal {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        min-height: 100%;
        height: auto;
        overflow: visible;
    }
    
    .checkout-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    .checkout-container {
        position: relative;
        width: 100%;
        min-height: 100vh;
        height: auto;
        max-width: none;
        max-height: none;
        border-radius: 0;
        overflow: visible;
        padding-top: 50px;
        padding-bottom: 300px;
    }
    
    .checkout-close {
        top: 8px;
        right: 8px;
        position: fixed;
        z-index: 9999;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    
    #checkout {
        min-height: auto;
        height: auto;
        padding: 10px;
        padding-bottom: 100px;
        overflow: visible;
    }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========== Pricing Section ========== */
.pricing-section {
    margin-top: 40px;
}

.pricing-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
    text-align: center;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: stretch;
}

.pricing-card {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(52, 152, 219, 0.5);
}

/* Remove focus-within state that causes border to stick */
.pricing-card:focus-within {
    border-color: var(--border);
    transform: none;
    box-shadow: none;
}

/* Reset button focus styles */
.pricing-card .btn-checkout:focus {
    outline: none;
}

/* Recommended Card */
.pricing-card.recommended {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(142, 68, 173, 0.15) 0%, var(--bg-primary) 100%);
    transform: scale(1.02);
}

.pricing-card.recommended:hover {
    transform: scale(1.02) translateY(-4px);
    box-shadow: 0 8px 30px rgba(142, 68, 173, 0.5);
}

/* VIP Card */
.pricing-card.vip {
    border-color: #f39c12;
    background: linear-gradient(180deg, rgba(243, 156, 18, 0.1) 0%, var(--bg-primary) 100%);
}

.pricing-card.vip:hover {
    box-shadow: 0 8px 30px rgba(243, 156, 18, 0.5);
}

/* Badge */
.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pricing-badge.vip-badge {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

/* Header */
.pricing-header {
    margin-bottom: 16px;
}

.pricing-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.pricing-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Price */
.pricing-price {
    margin-bottom: 20px;
}

.price-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
    line-height: 1;
}

.pricing-card.vip .price-amount {
    color: #f39c12;
}

.price-period {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* Features */
.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    text-align: left;
    flex: 1;
}

.pricing-features li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.pricing-features li:last-child {
    border-bottom: none;
}

/* Checkout Button */
.btn-checkout {
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    background: #3498db;
    color: white;
    border: 2px solid #3498db;
}

.btn-checkout:hover:not(:disabled) {
    background: #2980b9;
    border-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.4);
}

/* 30 Day - Blue */
.btn-checkout.btn-30day {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.btn-checkout.btn-30day:hover:not(:disabled) {
    background: #2980b9;
    border-color: #2980b9;
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.4);
}

/* 365 Day - Purple (Recommended) */
.btn-checkout.btn-recommended {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.btn-checkout.btn-recommended:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* Lifetime - Gold (VIP) */
.btn-checkout.btn-vip {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-color: #f39c12;
    color: white;
}

.btn-checkout.btn-vip:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(243, 156, 18, 0.4);
    transform: translateY(-2px);
}

/* Disabled state */
.btn-checkout:disabled,
.btn-checkout.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Responsive */
@media (max-width: 800px) {
    /* Reorder sections on mobile: hero, license (with MAC + pricing), then features */
    .hero { order: 1; }
    .features { order: 3; }
    .license-section { order: 2; }
    .footer { order: 4; }
    
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .pricing-card.recommended {
        transform: none;
    }
    
    .pricing-card.recommended:hover {
        transform: translateY(-4px);
    }
}

/* ========== Header Navigation ========== */
.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.header-nav .logo {
    margin-bottom: 0;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

/* ========== Terms Page ========== */
.hero.compact {
    margin-bottom: 24px;
}

.hero.compact .tagline {
    display: none;
}

.terms-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
}

.terms-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.terms-updated {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 32px;
}

/* Language Switcher */
.language-switcher {
    text-align: right;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.language-switcher a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.language-switcher a:hover,
.language-switcher a.active {
    color: var(--accent);
}

.terms-content h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 32px;
    margin-bottom: 12px;
}

.terms-content h2:first-child {
    margin-top: 0;
}

.terms-content p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.7;
}

.terms-content ul {
    color: var(--text-secondary);
    margin-left: 24px;
    margin-bottom: 12px;
}

.terms-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.terms-content a {
    color: var(--accent);
    text-decoration: none;
}

.terms-content a:hover {
    text-decoration: underline;
}

.terms-content strong {
    color: var(--text-primary);
}

/* Footer separator */
.footer-links .separator {
    color: var(--text-muted);
    margin: 0 8px;
}

/* ========== Responsive for Terms ========== */
@media (max-width: 600px) {
    .header-nav {
        flex-direction: column;
        gap: 16px;
    }
    
    .terms-section {
        padding: 24px;
    }
    
    .terms-title {
        font-size: 1.5rem;
    }
}

/* ========== MAC Status ========== */
.mac-status {
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 20px;
}

.mac-status.checking {
    color: var(--text-secondary);
}

.mac-status.success {
    color: var(--success);
    font-weight: 600;
}

.mac-status.error {
    color: var(--error);
}

.mac-warning {
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ========== Disabled Purchase Buttons ========== */
.btn-checkout.disabled,
.btn-checkout:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--bg-card);
    border-color: var(--border);
}
