/* ===========================
   Global Styles & Variables
   =========================== */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Text Size Adjustment Classes */
body.text-small {
    font-size: 14px;
}

body.text-large {
    font-size: 18px;
}

body.text-xlarge {
    font-size: 20px;
}

/* ===========================
   Navigation Bar
   =========================== */
.navbar {
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-icon {
    height: 40px;
    width: auto;
    display: block;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

.text-size-control {
    display: flex;
    gap: 0.25rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
}

.size-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.85rem;
}

.size-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.mobile-menu-btn {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-md);
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 999;
}

.mobile-menu.active {
    display: flex;
}

/* ===========================
   Hero Section
   =========================== */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)" /></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 3rem;
    opacity: 0.95;
    line-height: 1.8;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.stat-card {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.cta-button {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* ===========================
   Introduction Section
   =========================== */
.intro-section {
    padding: 5rem 1.5rem;
    background: var(--bg-primary);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.intro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.intro-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    text-align: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.intro-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.intro-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.intro-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.intro-card p {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ===========================
   Content Sections
   =========================== */
.content-section {
    padding: 5rem 1.5rem;
    background: var(--bg-secondary);
}

.content-section:nth-child(even) {
    background: var(--bg-primary);
}

.level-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.beginner-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.intermediate-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.advanced-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.content-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.content-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.content-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.content-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.example-box {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.example-box.bad {
    border-color: var(--danger-color);
    background: #fef2f2;
}

.example-box.good {
    border-color: var(--secondary-color);
    background: #f0fdf4;
}

.example-label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.example-box code {
    display: block;
    background: white;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

.technique-note {
    background: #eff6ff;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    border-left: 3px solid var(--primary-color);
    color: var(--text-secondary);
}

.tips-box {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-top: 2rem;
}

.tips-box h4 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.tips-box ul {
    list-style: none;
    padding-left: 0;
}

.tips-box li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.tips-box li::before {
    content: '✓';
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* ===========================
   Examples Section
   =========================== */
.examples-section {
    background: var(--bg-primary);
}

.examples-grid {
    display: grid;
    gap: 1.5rem;
}

.example-category {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.example-category:hover {
    box-shadow: var(--shadow-md);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    background: var(--bg-primary);
    transition: var(--transition);
}

.category-header:hover {
    background: var(--bg-tertiary);
}

.category-icon {
    font-size: 2rem;
}

.category-header h3 {
    flex: 1;
    font-size: 1.3rem;
}

.expand-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.example-category.active .expand-icon {
    transform: rotate(180deg);
}

.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.example-category.active .category-content {
    max-height: 2000px;
}

.comparison-box {
    padding: 1.5rem;
    display: grid;
    gap: 1.5rem;
}

.comparison-item {
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 2px solid;
}

.comparison-item.poor {
    border-color: var(--danger-color);
    background: #fef2f2;
}

.comparison-item.strong {
    border-color: var(--secondary-color);
    background: #f0fdf4;
}

.comparison-item h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.comparison-item code {
    display: block;
    background: white;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===========================
   Playground Section
   =========================== */
.playground-section {
    background: var(--bg-secondary);
    padding: 5rem 1.5rem;
}

.playground-container {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.playground-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
}

.playground-tab {
    flex: 1;
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.playground-tab:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary-color);
}

.playground-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--bg-primary);
}

.playground-content {
    display: none;
    padding: 2rem;
}

.playground-content.active {
    display: block;
}

.builder-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.builder-section h3,
.builder-output h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.generated-prompt {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    min-height: 300px;
    margin-bottom: 1rem;
    border: 2px solid var(--border-color);
}

.generated-prompt .placeholder {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding-top: 2rem;
}

.generated-prompt.has-content {
    background: white;
    border-color: var(--primary-color);
    white-space: pre-wrap;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
}

.copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    margin-bottom: 1rem;
}

.copy-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.prompt-quality {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.prompt-quality h4 {
    margin-bottom: 1rem;
}

.quality-bar {
    background: var(--border-color);
    height: 30px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.quality-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger-color), var(--accent-color), var(--secondary-color));
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    color: white;
    font-weight: 600;
}

.analyzer-container {
    max-width: 900px;
    margin: 0 auto;
}

.analyzer-container h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.analyzer-container p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

#analyzerInput {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.analyze-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.analyze-btn:hover {
    background: var(--primary-dark);
}

.analysis-results {
    margin-top: 2rem;
}

.analysis-score {
    background: var(--bg-tertiary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    text-align: center;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    border: 8px solid;
}

.score-circle.poor {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.score-circle.fair {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.score-circle.good {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.analysis-feedback {
    display: grid;
    gap: 1rem;
}

.feedback-item {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border-left: 4px solid;
}

.feedback-item.positive {
    border-color: var(--secondary-color);
}

.feedback-item.negative {
    border-color: var(--danger-color);
}

.feedback-item.suggestion {
    border-color: var(--accent-color);
}

.feedback-item h4 {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.template-card {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.template-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.template-card h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.template-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.template-preview {
    display: block;
    background: white;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===========================
   Mistakes Section
   =========================== */
.mistakes-section {
    background: var(--bg-primary);
    padding: 5rem 1.5rem;
}

.mistakes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.mistake-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.mistake-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.mistake-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.mistake-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--danger-color);
}

.mistake-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.8;
}

.mistake-fix {
    background: #f0fdf4;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===========================
   Best Practices Section
   =========================== */
.best-practices-section {
    background: var(--bg-secondary);
    padding: 5rem 1.5rem;
}

.checklist-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.checklist-column {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.checklist-column h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.checklist-item:hover {
    background: var(--bg-tertiary);
}

.checklist-item input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checklist-item label {
    flex: 1;
    cursor: pointer;
    line-height: 1.6;
}

.checklist-item input[type="checkbox"]:checked + label {
    text-decoration: line-through;
    color: var(--text-light);
}

/* ===========================
   Footer
   =========================== */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 1.5rem 1.5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
}

.footer-section a {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.footer-section a:hover {
    color: white;
    padding-left: 0.5rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 1024px) {
    .builder-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-stats {
        gap: 1.5rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .nav-controls {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .logo-icon {
        height: 32px;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .intro-grid,
    .examples-grid,
    .mistakes-grid,
    .checklist-container,
    .templates-grid {
        grid-template-columns: 1fr;
    }

    .playground-tabs {
        flex-direction: column;
    }

    .playground-tab {
        border-bottom: 1px solid var(--border-color);
    }
    
    .comparison-box {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .hero {
        padding: 4rem 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .content-section {
        padding: 3rem 1rem;
    }

    .content-card {
        padding: 1.5rem;
    }

    .example-box code {
        font-size: 0.8rem;
    }
}

/* ===========================
   Animations
   =========================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-card,
.intro-card,
.example-category,
.mistake-card {
    animation: fadeInUp 0.6s ease-out;
}

/* ===========================
   Utility Classes
   =========================== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
    display: none;
}

/* Print Styles */
@media print {
    .navbar,
    .mobile-menu,
    .hero,
    .footer,
    .playground-section {
        display: none;
    }

    .content-section {
        page-break-inside: avoid;
    }
}

