:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #7d8590;
    --text-muted: #656d76;
    --accent-blue: #2f81f7;
    --accent-blue-hover: #388bfd;
    --success-color: #238636;
    --error-color: #da3633;
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace;
}

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

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ====== Header ====== */
.header {
    text-align: center;
    padding: 2rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ====== Main Content ====== */
.container {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

/* ====== Input Section ====== */
.input-section {
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.input-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.input-wrapper {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.input-field {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.1);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s ease;
    display: none;
}

.clear-btn:hover {
    color: var(--text-primary);
}

.clear-btn.show {
    display: block;
}

.generate-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.generate-btn:hover:not(:disabled) {
    background: var(--accent-blue-hover);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ====== Example Section ====== */
.example-section {
    margin-bottom: 1.5rem;
}

.example-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.example-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.example-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.example-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

.example-icon {
    width: 16px;
    height: 16px;
}

/* ====== Responsive for Mobile ====== */
@media (max-width: 600px) {
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .input-label {
        margin-bottom: 0.5rem;
    }

    .generate-btn {
        width: 100%;
    }
}

/* ====== Options Section ====== */
.options-section {
    margin-bottom: 1.5rem;
}

.options-header {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
}

.options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.option-item.active {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.option-item:hover {
    background: var(--bg-tertiary);
}

.option-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* ====== Error Message ====== */
.error-message {
    background: rgba(218, 54, 51, 0.1);
    border: 1px solid rgba(218, 54, 51, 0.2);
    color: var(--error-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: none;
}

.error-message.show {
    display: block;
}

/* ====== Output Section ====== */
.output-section {
    position: relative;
}

.output-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

.output-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.output-tree {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--success-color);
    padding: 1rem;
    white-space: pre;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

/* ====== Loading State ====== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 17, 23, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ====== Action Buttons ====== */
.actions {
    display: none;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.actions.show {
    display: flex;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.action-btn svg {
    width: 16px;
    height: 16px;
}

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

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* ====== Responsive ====== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    .input-group {
        flex-direction: column;
    }

    .generate-btn {
        width: 100%;
    }

    .options-grid {
        justify-content: center;
    }

    .actions {
        flex-wrap: wrap;
    }

    .action-btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}
