/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0a0f;
    color: #e4e4e7;
    min-height: 100vh;
    overflow: hidden;
}
::selection { background: rgba(99, 102, 241, 0.3); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* === LAYOUT === */
.layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* === SIDEBAR === */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: rgba(15, 15, 23, 0.95);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    transition: transform 0.3s ease;
    z-index: 50;
}
.sidebar-header {
    padding: 20px 16px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.logo-text {
    font-weight: 700;
    font-size: 18px;
    background: linear-gradient(135deg, #e4e4e7, #a1a1aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-toggle { display: none; background: none; border: none; color: #71717a; cursor: pointer; }

/* Command trigger */
.command-trigger {
    margin: 4px 12px 12px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #71717a;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.command-trigger:hover { background: rgba(255,255,255,0.08); color: #a1a1aa; }
.command-trigger kbd {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    font-family: inherit;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}
.nav-group { margin-bottom: 8px; }
.nav-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #52525b;
    padding: 12px 12px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 6px;
    color: #a1a1aa;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #e4e4e7; }
.nav-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}
.nav-icon {
    width: 24px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.pro-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.pro-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }
.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
}
.footer-links a { color: #52525b; text-decoration: none; }
.footer-links a:hover { color: #a1a1aa; }
.footer-links span { color: #3f3f46; }

/* === MAIN === */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.main-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(15, 15, 23, 0.5);
    backdrop-filter: blur(10px);
}
.main-header h1 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}
.mobile-menu {
    display: none;
    background: none;
    border: none;
    color: #a1a1aa;
    cursor: pointer;
}
.header-actions { display: flex; gap: 8px; }
.btn-ghost {
    padding: 6px 12px;
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #a1a1aa;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.06); color: #e4e4e7; }

.tool-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* === TOOL PANELS === */
.tool-panel { display: none; animation: fadeIn 0.2s ease; }
.tool-panel.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-description {
    color: #71717a;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.tool-grid.single { grid-template-columns: 1fr; }

.panel {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    overflow: hidden;
}
.panel-header {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #71717a;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-body { padding: 0; }

textarea.code-input, pre.code-output {
    width: 100%;
    min-height: 320px;
    padding: 16px;
    background: transparent;
    border: none;
    color: #e4e4e7;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    tab-size: 2;
}
pre.code-output {
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}
textarea.code-input::placeholder { color: #3f3f46; }

/* Action buttons */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(99,102,241,0.3); transform: translateY(-1px); }
.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: #a1a1aa;
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: #e4e4e7; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.copy-btn {
    padding: 4px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #71717a;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.copy-btn:hover { background: rgba(255,255,255,0.1); color: #a1a1aa; }
.copy-btn.copied { background: rgba(34,197,94,0.15); color: #4ade80; border-color: rgba(34,197,94,0.3); }

/* Inline controls */
.control-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.control-label {
    font-size: 13px;
    color: #71717a;
    font-weight: 500;
}
.control-input {
    padding: 6px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #e4e4e7;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.control-input:focus { border-color: rgba(99,102,241,0.5); }
select.control-input {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    -webkit-appearance: none;
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2371717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
input[type="range"] { accent-color: #6366f1; }
input[type="checkbox"] { accent-color: #6366f1; }

/* Status badge */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.status.valid { color: #4ade80; }
.status.invalid { color: #f87171; }
.status-dot {
    width: 6px; height: 6px; border-radius: 50%;
}
.status.valid .status-dot { background: #4ade80; }
.status.invalid .status-dot { background: #f87171; }

/* Generated output cards */
.output-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    word-break: break-all;
}

/* Regex highlights */
.regex-match { background: rgba(99,102,241,0.3); border-radius: 2px; padding: 1px 0; }

/* Color swatch */
.color-preview {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

/* Markdown preview */
.markdown-preview {
    padding: 16px;
    line-height: 1.7;
    font-size: 14px;
}
.markdown-preview h1 { font-size: 24px; margin: 16px 0 8px; }
.markdown-preview h2 { font-size: 20px; margin: 14px 0 6px; }
.markdown-preview h3 { font-size: 17px; margin: 12px 0 4px; }
.markdown-preview p { margin: 8px 0; }
.markdown-preview code { background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.markdown-preview pre { background: rgba(255,255,255,0.06); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
.markdown-preview pre code { background: none; padding: 0; }
.markdown-preview ul, .markdown-preview ol { padding-left: 24px; margin: 8px 0; }
.markdown-preview blockquote { border-left: 3px solid #6366f1; padding-left: 16px; color: #a1a1aa; margin: 8px 0; }
.markdown-preview a { color: #818cf8; }
.markdown-preview hr { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 16px 0; }

/* Diff */
.diff-line { padding: 2px 16px; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.diff-add { background: rgba(34,197,94,0.1); color: #4ade80; }
.diff-remove { background: rgba(239,68,68,0.1); color: #f87171; }
.diff-same { color: #71717a; }

/* QR Code */
.qr-output { display: flex; align-items: center; justify-content: center; padding: 24px; }
.qr-output canvas { border-radius: 8px; }

/* === COMMAND PALETTE === */
.command-palette { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding-top: 20vh; }
.command-palette.hidden { display: none; }
.command-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.command-modal {
    position: relative;
    width: 560px;
    max-width: 90vw;
    background: #18181b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.command-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: #71717a;
}
.command-input-wrap input {
    flex: 1;
    background: none;
    border: none;
    color: #e4e4e7;
    font-size: 15px;
    font-family: inherit;
    outline: none;
}
.command-input-wrap kbd {
    font-size: 11px;
    padding: 2px 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: #52525b;
    font-family: inherit;
}
.command-results { max-height: 320px; overflow-y: auto; padding: 8px; }
.command-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #a1a1aa;
    transition: background 0.1s;
}
.command-result:hover, .command-result.selected { background: rgba(255,255,255,0.06); color: #e4e4e7; }
.command-result .nav-icon { width: 28px; text-align: center; font-size: 13px; font-family: 'JetBrains Mono', monospace; }

/* === EMAIL MODAL === */
.email-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.email-modal.hidden { display: none; }
.email-modal-content {
    position: relative;
    width: 420px;
    max-width: 90vw;
    background: #18181b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.email-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #52525b;
    font-size: 20px;
    cursor: pointer;
}
.email-icon { font-size: 40px; margin-bottom: 12px; }
.email-modal-content h3 { font-size: 20px; margin-bottom: 8px; }
.email-modal-content p { color: #71717a; font-size: 14px; margin-bottom: 16px; }
#email-form {
    display: flex;
    gap: 8px;
}
#email-input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #e4e4e7;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}
#email-input:focus { border-color: rgba(99,102,241,0.5); }
#email-submit {
    padding: 10px 20px;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.email-note { font-size: 12px; color: #3f3f46; margin-top: 12px; }

/* === PRICING === */
.pricing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 700px;
}
.pricing-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 32px;
}
.pricing-card.featured {
    border-color: rgba(99,102,241,0.4);
    background: rgba(99,102,241,0.06);
    position: relative;
}
.pricing-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pricing-card h3 { font-size: 20px; margin-bottom: 4px; }
.pricing-price { font-size: 36px; font-weight: 700; margin: 12px 0; }
.pricing-price span { font-size: 16px; color: #71717a; font-weight: 400; }
.pricing-features { list-style: none; margin: 20px 0; }
.pricing-features li {
    padding: 6px 0;
    font-size: 14px;
    color: #a1a1aa;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pricing-features li::before { content: '✓'; color: #4ade80; font-weight: 700; }
.pricing-card .btn { width: 100%; text-align: center; }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: #18181b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #e4e4e7;
    font-size: 13px;
    font-weight: 500;
    z-index: 200;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .mobile-menu { display: block; }
    .tool-grid { grid-template-columns: 1fr; }
    .pricing-grid { grid-template-columns: 1fr; }
    .tool-container { padding: 16px; }
    textarea.code-input, pre.code-output { min-height: 200px; }
}
