/* === DevToolCore v2 闂佺偨鍎查幗顦昫ern Design (inspired by deepseek.com) === */

/* === Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #1e293b;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Top Bar 闂佺偨鍎查弨鐚痑ssmorphism === */
.topbar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: 52px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-brand {
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #818cf8, #6366f1, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.topbar-brand:hover { color: #fff; }
.topbar-link {
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    margin-left: 1.2rem;
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 0.2s;
    letter-spacing: 0.01em;
}
.topbar-link:hover { color: rgba(255,255,255,0.9); }
.sidebar-toggle {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    color: rgba(255,255,255,0.7);
    padding: 5px 10px;
    line-height: 1;
    transition: all 0.2s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* === App Layout === */
.app-layout { display: flex; min-height: calc(100vh - 52px); }

/* === Sidebar === */
.sidebar {
    width: 200px;
    min-width: 200px;
    flex-shrink: 0;
    background: #0f172a;
    color: rgba(255,255,255,0.6);
    overflow-y: auto;
    padding: 12px 0;
    position: relative;
    transition: width 0.25s cubic-bezier(0.4,0,0.2,1), min-width 0.25s cubic-bezier(0.4,0,0.2,1);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.sidebar-collapsed { width: 40px; min-width: 40px; padding: 8px 0; }
.sidebar-collapsed .sidebar-nav,
.sidebar-collapsed .sidebar-section { display: none; }

.sidebar-section { margin-bottom: 4px; }
.sidebar-title {
    padding: 10px 18px 5px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.2);
}
.sidebar-link {
    display: block;
    padding: 6px 18px 6px 22px;
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.15s;
    border-radius: 0 6px 6px 0;
    margin-right: 8px;
}
.sidebar-link:hover { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.8); }
.sidebar-link.active {
    background: linear-gradient(90deg, rgba(99,102,241,0.15), transparent);
    color: #a5b4fc;
    font-weight: 600;
    border-left-color: #818cf8;
}

.sidebar-grip {
    position: absolute;
    right: 0; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: #fff; font-size: 10px; font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 6px 0 0 6px;
    transition: all 0.2s;
    z-index: 20;
    opacity: 0.6;
}
.sidebar-grip:hover { opacity: 1; width: 20px; }
.sidebar-collapsed .sidebar-grip { right: auto; left: 0; border-radius: 0 6px 6px 0; width: 20px; }

/* === Main Content === */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 24px 28px;
    background: #ffffff;
    border-radius: 16px 0 0 0;
    margin-top: -8px;
    position: relative;
    z-index: 1;
}

/* === Tool Heading === */
.tool-heading {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 0 4px;
    color: #0f172a;
    letter-spacing: -0.02em;
}
.tool-subtitle {
    font-size: 0.88rem;
    color: #64748b;
    margin: 0 0 18px;
    line-height: 1.5;
}

/* === Tool Panels === */
.tool-panels { display: flex; gap: 16px; height: calc(100vh - 280px); min-height: 400px; }
.tool-panel {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 12px;
    transition: border-color 0.2s;
}
.tool-panel:focus-within { border-color: #a5b4fc; }
.tool-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; min-height: 30px; }
.tool-label { font-size: 0.72rem; font-weight: 700; color: #0f172a; text-transform: uppercase; letter-spacing: 0.8px; }
.tool-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tool-btn-clear { background: none; border: none; font-size: 0.78rem; color: #64748b; cursor: pointer; padding: 0; transition: color 0.15s; }
.tool-btn-clear:hover { color: #ef4444; }
.tool-stats { font-size: 0.75rem; color: #64748b; margin-top: 4px; }

.tool-btn {
    font-size: 0.78rem;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-weight: 500;
}
.tool-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.tool-btn.active { background: #1e293b; border-color: #1e293b; color: #fff; }
.tool-btn.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.tool-btn.primary:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
    transform: translateY(-1px);
}
.tool-btn.copy-done {
    background: linear-gradient(135deg, #059669, #10b981);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

/* === Textarea & Output === */
.tool-textarea, .output-area {
    margin: 0;
    flex: 1 1 auto;
    width: 100%;
    min-height: 350px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 14px 16px;
    background: #fff;
    color: #1e293b;
    resize: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.tool-textarea:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.output-area { background: #fafbfc; }

/* === Footer === */
.footer {
    padding: 20px 0;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.78);
    background: #0f172a;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.footer a { color: rgba(255,255,255,0.6); text-decoration: none; transition: color 0.15s; }
.footer a:hover { color: #fff; }

/* === Toast === */
.toast-container { position: fixed; top: 64px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    background: #1e293b;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    backdrop-filter: blur(8px);
}
.toast-item.success { background: linear-gradient(135deg, #059669, #10b981); }
.toast-item.error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.toast-enter { transition: all 0.3s cubic-bezier(0.4,0,0.2,1); }
.toast-leave { transition: all 0.2s ease-in; }
.toast-enter-start { opacity: 0; transform: translateX(40px); }
.toast-enter-end { opacity: 1; transform: translateX(0); }
.toast-leave-start { opacity: 1; }
.toast-leave-end { opacity: 0; transform: translateX(40px); }

/* === Cookie Banner === */
.cookie-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 9998;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    color: #e2e8f0;
    padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.cookie-banner-text { font-size: 0.82rem; flex: 1; min-width: 240px; }
.cookie-banner-actions { display: flex; align-items: center; flex-shrink: 0; }
.cookie-enter { transition: all 0.3s ease-out; }
.cookie-leave { transition: all 0.2s ease-in; }
.cookie-enter-start { opacity: 0; transform: translateY(20px); }
.cookie-enter-end { opacity: 1; transform: translateY(0); }
.cookie-leave-start { opacity: 1; }
.cookie-leave-end { opacity: 0; }
[x-cloak] { display: none !important; }

/* === Landing Page === */
.tool-card {
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    min-height: 150px;
    height: 100%;
}
.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(99,102,241,0.12) !important;
    border-color: #c7d2fe !important;
}

/* === Tool Card Grid === */
.row.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
@media (max-width: 991.98px) {
    .row.tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 575.98px) {
    .row.tool-grid {
        grid-template-columns: 1fr;
    }
}

/* Override Bootstrap col widths in grid context */
.row.tool-grid > .col-md-6,
.row.tool-grid > .col-lg-4 {
    width: auto;
    max-width: none;
    flex: none;
    padding: 0;
}
.tool-icon {
    font-size: 1.2rem;
    color: #6366f1;
    font-weight: 800;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

/* Landing SEO section */
.seo-section h2 { font-size: 1.15rem; font-weight: 700; color: #0f172a; letter-spacing: -0.01em; }
.seo-section p { color: #475569; font-size: 0.92rem; line-height: 1.7; }
.faq-section .accordion-button { font-size: 0.9rem; font-weight: 600; }

/* === Timestamp Converter === */
.current-ts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.ts-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px; transition: border-color 0.2s; }
.ts-card:hover { border-color: #c7d2fe; }
.ts-card .ts-label { display: block; font-size: 11px; color: #64748b; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }
.ts-card input { width: 100%; border: none; background: transparent; font-family: 'JetBrains Mono', monospace; font-size: 14px; color: #1e293b; cursor: pointer; }
.ts-card input:focus { outline: none; }
.convert-row { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.convert-row input[type="text"] { flex: 1; min-width: 200px; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 14px; font-family: 'JetBrains Mono', monospace; transition: border-color 0.2s; }
.convert-row input[type="text"]:focus { border-color: #818cf8; outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.convert-row input[type="datetime-local"] { flex: 1; min-width: 200px; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 14px; }
.convert-row select { padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 14px; }
.convert-row button {
    padding: 10px 24px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; border: none; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
    transition: all 0.2s;
}
.convert-row button:hover { box-shadow: 0 4px 12px rgba(99,102,241,0.4); transform: translateY(-1px); }
.result-box { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.result-box div { margin-bottom: 6px; font-size: 14px; }
.result-box div:last-child { margin-bottom: 0; }
.result-box span { font-family: 'JetBrains Mono', monospace; color: #4338ca; }
.related-tools { margin-top: 32px; }
.related-tools h3 { font-size: 16px; color: #0f172a; margin-bottom: 12px; font-weight: 700; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.related-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; text-decoration: none; color: #1e293b; font-size: 14px; text-align: center; transition: all 0.2s; font-weight: 500; }
.related-card:hover { background: #eef2ff; border-color: #c7d2fe; transform: translateY(-2px); }
.faq-section h3 { font-size: 16px; color: #0f172a; margin: 32px 0 12px; font-weight: 700; }
.faq-section details { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px 16px; margin-bottom: 8px; transition: border-color 0.2s; }
.faq-section details:hover { border-color: #c7d2fe; }
.faq-section details[open] { border-color: #a5b4fc; background: #eef2ff; }
.faq-section details summary { cursor: pointer; font-weight: 600; font-size: 14px; color: #1e293b; }
.faq-section details p { margin: 10px 0 0; color: #475569; font-size: 14px; line-height: 1.65; }
.tool-container { max-width: 800px; margin: 0 auto; }
.tool-container h1 { font-size: 1.6rem; color: #0f172a; margin-bottom: 8px; font-weight: 800; letter-spacing: -0.02em; }
.tool-intro { color: #64748b; font-size: 0.93rem; margin-bottom: 28px; }
.tool-section h2 { font-size: 1.1rem; font-weight: 700; color: #0f172a; margin: 28px 0 14px; padding-bottom: 10px; border-bottom: 2px solid #e2e8f0; }

/* === JSON Tree === */
.json-ul { list-style: none; padding-left: 1em; margin: 0; }
.json-ul li { line-height: 1.6; }
.json-toggle {
    cursor: pointer;
    display: inline-block;
    width: 14px;
    margin-right: 2px;
    color: #64748b;
    font-size: 10px;
    user-select: none;
    vertical-align: top;
    padding-top: 2px;
    transition: color 0.15s;
}
.json-toggle:hover { color: #6366f1; }
.json-toggle::before { content: '\25BC'; }
li.collapsed > .json-toggle::before { content: '\25B6'; }
li.collapsed > .json-ul,
li.collapsed > ul.json-ul { display: none; }
.json-key { color: #be185d; font-weight: 500; }
.json-string { color: #047857; }
.json-number { color: #1d4ed8; }
.json-bool { color: #7c3aed; }
.json-null { color: #64748b; }
.text-danger { color: #dc2626; }
.text-muted { color: #64748b; }

/* === Animations === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.container.py-4 > * { animation: fadeInUp 0.4s ease-out both; }
.container.py-4 > *:nth-child(2) { animation-delay: 0.05s; }
.container.py-4 > *:nth-child(3) { animation-delay: 0.1s; }

/* === Responsive === */
@media (max-width: 768px) {
    .tool-panels { flex-direction: column; }
    .sidebar { width: 160px; min-width: 160px; }
    .main-content { padding: 16px; }
    .topbar { padding: 0 12px; }
}