:root {
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --secondary: #94A3B8;
    --accent: #22D3EE;
    --bg: #0F172A;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --text: #F8FAFC;
    --text-muted: #CBD5E1;
    --border: rgba(71, 85, 105, 0.5);
    --radius: 12px;
    --error: #ef4444;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg);
    background-image: radial-gradient(circle at 100% 0%, rgba(34, 211, 238, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app {
    width: 100%;
    max-width: 1400px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo svg {
    color: var(--accent);
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.glass-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

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

.glass-btn.action-primary:hover {
    background: var(--primary-hover);
}

.glass-btn.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

/* Path Input */
.path-input-section {
    padding: 1.2rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

.prefix {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 1rem;
    user-select: none;
}

.path-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: 'Fira Code', monospace;
    font-size: 1.1rem;
}

.path-input:focus {
    outline: none;
}

.error-msg {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: none;
}

/* Editor Grid */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

.editor-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 12px;
}

.code-editor,
.results-container {
    flex: 1;
    padding: 1.2rem;
    overflow: auto;
    background: transparent;
    color: var(--text);
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-editor {
    border: none;
    resize: none;
    width: 100%;
}

.code-editor:focus {
    outline: none;
}

.code-output {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Reference Panel */
.reference-panel {
    padding: 1.2rem;
}

.reference-panel h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.ref-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s;
}

.ref-item:hover {
    border-color: var(--accent);
    background: rgba(34, 211, 238, 0.05);
}

.ref-item code {
    display: block;
    color: var(--accent);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.ref-item span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

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