/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #059669;
    --danger-color: #dc2626;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --white: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-brand a {
    text-decoration: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-menu a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-login, .btn-logout {
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-try-free {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Hero Section */
.hero {
    padding: 4rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.hero-note {
    opacity: 0.8;
    font-size: 0.875rem;
}

.puzzle-preview {
    background: var(--white);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.grid-visual {
    width: 100%;
    aspect-ratio: 1;
    background:
        linear-gradient(to right, #000 2px, transparent 2px),
        linear-gradient(to bottom, #000 2px, transparent 2px),
        linear-gradient(to right, #000 3px, transparent 3px),
        linear-gradient(to bottom, #000 3px, transparent 3px);
    background-size:
        calc(100% / 9) calc(100% / 9),
        calc(100% / 9) calc(100% / 9),
        calc(100% / 3) calc(100% / 3),
        calc(100% / 3) calc(100% / 3);
}

/* Features Section */
.features {
    padding: 5rem 0;
    background: var(--bg-light);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.feature-card p {
    color: var(--text-light);
}

/* Pricing Section */
.pricing {
    padding: 5rem 0;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    position: relative;
    transition: transform 0.3s;
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.pricing-card.featured {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.2);
}

.plan-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--primary-color);
    color: var(--white);
    padding: 0.25rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.plan-badge-annual {
    background: var(--success-color);
}

.plan-header h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.price {
    margin-bottom: 1.5rem;
}

.price .amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.price .period {
    color: var(--text-light);
    font-size: 1rem;
}

.price-note {
    color: var(--success-color);
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.plan-features {
    list-style: none;
    margin-bottom: 2rem;
}

.plan-features li {
    padding: 0.5rem 0;
    color: var(--text-dark);
}

/* CTA Section */
.cta {
    padding: 5rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    text-align: center;
}

.cta h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.cta p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Generator Section */
.generator-section {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.quota-display {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.quota-item {
    display: flex;
    gap: 0.5rem;
}

.quota-label {
    font-weight: 600;
    color: var(--text-light);
}

.quota-value {
    font-weight: 700;
    color: var(--primary-color);
}

.generator-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
}

.controls-panel, .puzzle-panel {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
}

.controls-panel h2 {
    margin-bottom: 1.5rem;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.error-message {
    background: #fee;
    color: var(--danger-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.export-panel {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.export-panel h3 {
    margin-bottom: 1rem;
}

.checkbox-group {
    margin-bottom: 1rem;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-export {
    background: var(--success-color);
    color: var(--white);
}

.btn-export:hover {
    background: #047857;
}

.btn-export:disabled,
.btn-pro-only:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-export:disabled:hover,
.btn-pro-only:disabled:hover {
    background: #ccc;
    transform: none;
}

.upgrade-cta {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 0.5rem;
    text-align: center;
}

/* Puzzle Display */
.puzzle-display {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.puzzle-placeholder {
    text-align: center;
    color: var(--text-light);
}

.placeholder-icon {
    font-size: 4rem;
    margin-top: 1rem;
}

.loading-spinner {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Sudoku Grid */
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    border: 3px solid #000;
    width: fit-content;
    margin: 0 auto;
}

.sudoku-cell {
    width: 50px;
    height: 50px;
    border: 1px solid #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
}

.sudoku-cell.given {
    background: var(--bg-light);
    font-weight: 700;
    color: #000;
}

.sudoku-cell:nth-child(3n) {
    border-right: 2px solid #000;
}

.sudoku-cell:nth-child(9n) {
    border-right: 1px solid #999;
}

.sudoku-grid > .sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-grid > .sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #000;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: var(--white);
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
}

.footer-links {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer-links a {
    color: var(--white);
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero .container {
        grid-template-columns: 1fr;
    }

    .generator-container {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .hero-cta {
        flex-direction: column;
    }

    .quota-display {
        flex-direction: column;
        gap: 1rem;
    }

    .sudoku-cell {
        width: 35px;
        height: 35px;
        font-size: 1.125rem;
    }
}