:root {
    --bg-main: #0d1117;
    --bg-sidebar: #161b22;
    --bg-card: rgba(28, 33, 40, 0.6);
    --border: #30363d;
    --fg-primary: #e6edf3;
    --fg-secondary: #7d8590;
    --accent: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.3);
    --success: #3fb950;
    --danger: #f85149;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--fg-primary);
    background-color: var(--bg-main);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
}

.brand {
    display: flex;
    align-items: center;
    padding: 0 24px;
    margin-bottom: 40px;
}

.brand .logo {
    font-size: 24px;
    margin-right: 12px;
}

.brand h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--fg-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 24px;
    margin-bottom: 12px;
}

.tool-nav {
    flex: 1;
}

.tool-btn {
    width: 100%;
    background: none;
    border: none;
    color: var(--fg-secondary);
    text-align: left;
    padding: 12px 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn .icon {
    width: 16px;
    margin-right: 12px;
    opacity: 0.5;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--fg-primary);
}

.tool-btn.active {
    color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
    border-left: 3px solid var(--accent);
    font-weight: 600;
}

.tool-btn.active .icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--fg-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top right, #1a1f28, #0d1117);
    overflow-y: auto;
}

.main-header {
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.config-section {
    padding: 0 40px;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-bottom: 24px;
}

.card.wide {
    grid-row: span 1;
}

.options-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.option-category {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cat-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(88, 166, 255, 0.2);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-text {
    display: flex;
    flex-direction: column;
}

.option-title {
    font-size: 13px;
    font-weight: 500;
}

/* Switch UI */
.switch-container {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #30363d;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(14px);
}

/* Editor Section */
.editor-section {
    padding: 0 40px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.editor-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--fg-secondary);
}

.badge {
    padding: 4px 8px;
    background: #1f6feb;
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

.editor-wrapper {
    flex: 1;
    display: flex;
    background: #0d1117;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.line-numbers {
    width: 40px;
    background: #161b22;
    color: #484f58;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    text-align: right;
    padding: 16px 8px;
    user-select: none;
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: #d1d5db;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    resize: none;
    outline: none;
}

.preview-textarea {
    width: 100%;
    height: 300px;
    background: rgba(28, 33, 40, 0.4);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--fg-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 16px;
    resize: vertical;
    outline: none;
}

.preview-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

/* Action Bar */
.action-bar {
    padding: 24px 40px;
    display: flex;
    justify-content: center;
}

.btn-primary {
    background-color: #238636;
    color: white;
    border: 1px solid rgba(240, 246, 252, 0.1);
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 12px rgba(35, 134, 54, 0.2);
}

.btn-primary:hover {
    background-color: #2ea043;
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: none;
    border: 1px solid var(--border);
    color: var(--fg-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #8b949e;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-toggle-group {
    display: flex;
    background: var(--bg-sidebar);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.lang-btn {
    background: none;
    border: none;
    color: var(--fg-secondary);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.lang-btn.active {
    background: var(--accent);
    color: white;
}

.card-simple {
    padding: 10px 0;
    margin-bottom: 20px;
    background: transparent;
    border: none;
}

.card-simple input[type="text"] {
    width: 400px;
    background: #000;
    border: 1px solid #535353;
    border-radius: 1px;
    padding: 5px 10px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
}

.card-simple .btn-verify {
    background: #21262d;
    border: 1px solid #30363d;
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.card-simple .btn-verify:hover {
    background: #30363d;
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f6feb;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease, bottom 0.3s ease;
    z-index: 1000;
}

.toast.hidden {
    opacity: 0;
    bottom: 20px;
    pointer-events: none;
}

.toast.error {
    background: var(--danger);
}

.toast.success {
    background: var(--success);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.editor-wrapper,
.action-bar {
    animation: fadeIn 0.4s ease-out backwards;
}

.card:nth-child(2) {
    animation-delay: 0.1s;
}

.editor-wrapper {
    animation-delay: 0.2s;
}

.action-bar {
    animation-delay: 0.3s;
}