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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --success-color: #22c55e;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Consolas', monospace;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    flex: 1;
}

/* Controls Panel */
.controls-panel {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
    border: 1px solid var(--border-color);
}

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

.control-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.control-group select,
.control-group input[type="range"] {
    width: 100%;
}

select {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:hover {
    border-color: var(--primary-color);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-color);
    border-radius: 3px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* Buttons */
.generate-btn,
.copy-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.generate-btn {
    background: var(--primary-color);
    color: white;
    margin-bottom: 0.75rem;
}

.generate-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.generate-btn:active {
    transform: translateY(0);
}

.copy-btn {
    background: var(--surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.copy-btn:hover {
    background: var(--border-color);
}

.btn-icon {
    font-size: 1.1rem;
}

/* Code Panel */
.code-panel {
    background: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.window-controls {
    display: flex;
    gap: 0.5rem;
}

.window-controls .control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.window-controls .red { background: #ef4444; }
.window-controls .yellow { background: #eab308; }
.window-controls .green { background: #22c55e; }

.filename {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.code-container {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    min-height: 400px;
    max-height: 70vh;
}

.code-container pre {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

.code-container code {
    display: block;
    white-space: pre;
    tab-size: 4;
}

/* Syntax Highlighting - Dark Theme (Monokai) */
.theme-dark {
    background: #272822;
}

.theme-dark .keyword { color: #f92672; }
.theme-dark .string { color: #e6db74; }
.theme-dark .number { color: #ae81ff; }
.theme-dark .comment { color: #75715e; font-style: italic; }
.theme-dark .function { color: #a6e22e; }
.theme-dark .class { color: #66d9ef; font-style: italic; }
.theme-dark .variable { color: #f8f8f2; }
.theme-dark .operator { color: #f92672; }
.theme-dark .tag { color: #f92672; }
.theme-dark .attribute { color: #a6e22e; }
.theme-dark .property { color: #66d9ef; }
.theme-dark .type { color: #66d9ef; }

/* Light Theme */
.theme-light {
    background: #ffffff;
    color: #24292e;
}

.theme-light .keyword { color: #d73a49; }
.theme-light .string { color: #032f62; }
.theme-light .number { color: #005cc5; }
.theme-light .comment { color: #6a737d; font-style: italic; }
.theme-light .function { color: #6f42c1; }
.theme-light .class { color: #22863a; }
.theme-light .variable { color: #24292e; }
.theme-light .operator { color: #d73a49; }
.theme-light .tag { color: #22863a; }
.theme-light .attribute { color: #6f42c1; }
.theme-light .property { color: #005cc5; }
.theme-light .type { color: #6f42c1; }

/* Dracula Theme */
.theme-dracula {
    background: #282a36;
}

.theme-dracula .keyword { color: #ff79c6; }
.theme-dracula .string { color: #f1fa8c; }
.theme-dracula .number { color: #bd93f9; }
.theme-dracula .comment { color: #6272a4; font-style: italic; }
.theme-dracula .function { color: #50fa7b; }
.theme-dracula .class { color: #8be9fd; font-style: italic; }
.theme-dracula .variable { color: #f8f8f2; }
.theme-dracula .operator { color: #ff79c6; }
.theme-dracula .tag { color: #ff79c6; }
.theme-dracula .attribute { color: #50fa7b; }
.theme-dracula .property { color: #8be9fd; }
.theme-dracula .type { color: #8be9fd; }

/* GitHub Theme */
.theme-github {
    background: #0d1117;
}

.theme-github .keyword { color: #ff7b72; }
.theme-github .string { color: #a5d6ff; }
.theme-github .number { color: #79c0ff; }
.theme-github .comment { color: #8b949e; font-style: italic; }
.theme-github .function { color: #d2a8ff; }
.theme-github .class { color: #7ee787; }
.theme-github .variable { color: #c9d1d9; }
.theme-github .operator { color: #ff7b72; }
.theme-github .tag { color: #7ee787; }
.theme-github .attribute { color: #79c0ff; }
.theme-github .property { color: #79c0ff; }
.theme-github .type { color: #ff7b72; }

/* Nord Theme */
.theme-nord {
    background: #2e3440;
}

.theme-nord .keyword { color: #81a1c1; }
.theme-nord .string { color: #a3be8c; }
.theme-nord .number { color: #b48ead; }
.theme-nord .comment { color: #616e88; font-style: italic; }
.theme-nord .function { color: #88c0d0; }
.theme-nord .class { color: #8fbcbb; }
.theme-nord .variable { color: #d8dee9; }
.theme-nord .operator { color: #81a1c1; }
.theme-nord .tag { color: #81a1c1; }
.theme-nord .attribute { color: #8fbcbb; }
.theme-nord .property { color: #88c0d0; }
.theme-nord .type { color: #81a1c1; }

/* Solarized Dark Theme */
.theme-solarized {
    background: #002b36;
}

.theme-solarized .keyword { color: #859900; }
.theme-solarized .string { color: #2aa198; }
.theme-solarized .number { color: #d33682; }
.theme-solarized .comment { color: #586e75; font-style: italic; }
.theme-solarized .function { color: #268bd2; }
.theme-solarized .class { color: #b58900; }
.theme-solarized .variable { color: #839496; }
.theme-solarized .operator { color: #859900; }
.theme-solarized .tag { color: #268bd2; }
.theme-solarized .attribute { color: #b58900; }
.theme-solarized .property { color: #268bd2; }
.theme-solarized .type { color: #b58900; }

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--success-color);
    color: white;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .control-group {
        margin-bottom: 0;
    }

    .generate-btn,
    .copy-btn {
        margin-bottom: 0;
    }

    .code-container {
        min-height: 300px;
    }
}

@media (max-width: 600px) {
    .app-container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.875rem;
    }

    .controls-panel {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

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

    .code-container {
        min-height: 250px;
        padding: 0.75rem;
    }

    .code-container pre {
        font-size: 0.75rem;
    }
}

/* Scrollbar Styling */
.code-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.code-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.code-container::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* Animation for generate button */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.generate-btn:focus {
    animation: pulse 0.3s ease;
}
