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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border: #475569;
    --error: #ef4444;
    --success: #10b981;
    --code-bg: #0f172a;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.input-panel {
    grid-column: 1;
    grid-row: 1;
}

.macros-panel {
    grid-column: 2;
    grid-row: 1;
}

.controls {
    grid-column: 1 / -1;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.output-panel {
    grid-column: 1 / -1;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

textarea {
    width: 100%;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 300px;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.macros-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 0.5rem;
}

.macro-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.macro-item input {
    flex: 1;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem;
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
}

.macro-item input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.macro-item button {
    padding: 0.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.macro-help {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.macro-help code {
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow);
}

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

.output {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    min-height: 200px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    line-height: 1.5;
}

.output.success {
    border-color: var(--success);
}

.placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
    font-style: italic;
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
    padding: 1rem;
    color: var(--error);
    margin-top: 1rem;
}

.hidden {
    display: none;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--surface-light);
}

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

    .input-panel {
        grid-column: 1;
        grid-row: 1;
    }

    .macros-panel {
        grid-column: 1;
        grid-row: 2;
        max-height: 400px;
    }

    .controls {
        grid-column: 1;
        grid-row: 3;
    }

    .output-panel {
        grid-column: 1;
        grid-row: 4;
    }
}

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

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    textarea {
        min-height: 200px;
    }

    .macros-panel {
        max-height: 300px;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
