/* ============================================
   Skills 学习中心 — Warm Night Catalog
   ============================================ */

/* 1. CSS Variables
   ------------------------------------------ */
:root {
    /* Base */
    --bg-deep: #181818;
    --bg-main: #1e1e1e;
    --bg-surface: #272727;
    --bg-elevated: #2e2e2e;

    /* Accent — warm coral (参考原版) */
    --accent: #e8856a;
    --accent-soft: rgba(232, 133, 106, 0.12);
    --accent-medium: rgba(232, 133, 106, 0.25);
    --accent-glow: rgba(232, 133, 106, 0.06);

    /* Text */
    --text-primary: #e8e8e8;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;

    /* Utility */
    --border: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(232, 133, 106, 0.25);
    --code-bg: #222222;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-width: 260px;

    /* Timing */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. Reset + Base
   ------------------------------------------ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

code, pre {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

::selection {
    background: var(--accent-medium);
    color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 160, 84, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 160, 84, 0.35);
}

/* 3. Animations
   ------------------------------------------ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes subtlePulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

.animate-in > * {
    animation: fadeInUp 0.4s var(--ease) both;
}

.animate-in > *:nth-child(1) { animation-delay: 0s; }
.animate-in > *:nth-child(2) { animation-delay: 0.05s; }
.animate-in > *:nth-child(3) { animation-delay: 0.1s; }
.animate-in > *:nth-child(4) { animation-delay: 0.15s; }
.animate-in > *:nth-child(5) { animation-delay: 0.2s; }
.animate-in > *:nth-child(6) { animation-delay: 0.25s; }
.animate-in > *:nth-child(7) { animation-delay: 0.3s; }
.animate-in > *:nth-child(8) { animation-delay: 0.35s; }

/* 4. Three-column layout (desktop)
   ------------------------------------------ */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-main) 100%);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.detail-panel {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    height: 100vh;
    background: var(--bg-main);
    border-right: 1px solid var(--border);
}

.doc-panel {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    height: 100vh;
    background: var(--bg-deep);
}

.mobile-tabs {
    display: none;
}

/* 5. Sidebar styles
   ------------------------------------------ */
.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #b8863e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-title {
    font-family: Georgia, 'Palatino Linotype', 'Book Antiqua', serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.sidebar-subtitle {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 1px;
}

.search-wrap {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-input:focus {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 12px var(--accent-glow);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.sidebar-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.skill-count {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Category groups */
.category-group {
    border-bottom: 1px solid var(--border);
}

.category-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    user-select: none;
    transition: color 0.2s var(--ease);
    gap: 6px;
}

.category-header:hover {
    color: var(--text-secondary);
}

.category-header .arrow {
    font-size: 10px;
    display: inline-block;
    transition: transform 0.25s var(--ease);
}

.category-header.collapsed .arrow {
    transform: rotate(-90deg);
}

.category-items {
    display: block;
}

.category-items.hidden {
    display: none;
}

.skill-item {
    padding: 9px 16px 9px 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s var(--ease);
    border-left: 2px solid transparent;
    position: relative;
}

.skill-item:hover {
    color: var(--text-primary);
    background: var(--accent-glow);
    border-left-color: var(--border-accent);
}

.skill-item.active {
    color: var(--accent);
    background: linear-gradient(90deg, var(--accent-soft) 0%, transparent 100%);
    border-left: 2px solid var(--accent);
}

/* 6. Detail panel styles
   ------------------------------------------ */
.detail-empty,
.doc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
    font-size: 14px;
    text-align: center;
    gap: 16px;
}

.empty-illustration {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.empty-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border);
    margin-bottom: 12px;
    animation: subtlePulse 3s ease-in-out infinite;
}

.empty-line {
    width: 60px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 4px auto;
}

.empty-line.short {
    width: 40px;
}

/* Detail content */
.detail-content {
    max-width: 640px;
    margin: 0 auto;
}

.detail-content h2 {
    font-family: Georgia, 'Palatino Linotype', 'Book Antiqua', serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    padding-bottom: 12px;
    position: relative;
}

.detail-content h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    margin-top: 12px;
}

.detail-meta .tag {
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
    border: 1px solid var(--border-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-description {
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.detail-scenarios,
.detail-features {
    list-style: none;
    margin-bottom: 20px;
}

.detail-scenarios ul,
.detail-features ul {
    list-style: none;
    padding: 0;
}

.detail-scenarios li,
.detail-features li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    line-height: 1.7;
    color: var(--text-secondary);
    font-size: 14px;
}

.detail-scenarios li::before,
.detail-features li::before {
    content: '\2014';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 600;
}

/* Section title */
.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    margin-top: 28px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

/* Trigger section */
.trigger-section {
    margin-top: 16px;
    margin-bottom: 8px;
}

.trigger-detail {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 8px;
}

.trigger-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-top: 8px;
}

.trigger-box code {
    flex: 1;
    font-size: 13px;
    color: var(--accent);
    word-break: break-all;
}

.copy-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-tertiary);
    transition: all 0.2s var(--ease);
}

.copy-btn:hover {
    background: var(--accent-soft);
    border-color: var(--border-accent);
    color: var(--accent);
}

/* Example context */
.example-context {
    font-style: italic;
    background: var(--bg-surface);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    border: 1px solid var(--border);
}

/* Conversation / chat bubbles */
.conversation {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.message-user,
.message-claude {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.7;
}

.message-user {
    background: var(--bg-surface);
    border-left: 3px solid #5b7a99;
}

.message-claude {
    background: var(--accent-glow);
    border-left: 3px solid var(--accent);
}

.msg-role {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.msg-content {
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Tip box */
.tip-box {
    background: var(--accent-soft);
    border-left: 2px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    font-style: italic;
}

/* Badge auto */
.badge-auto {
    font-weight: 600;
}

/* 7. Markdown rendering styles (.doc-content)
   ------------------------------------------ */
.doc-content {
    max-width: 640px;
    margin: 0 auto;
}

.doc-content h1 {
    font-family: Georgia, 'Palatino Linotype', 'Book Antiqua', serif;
    font-size: 26px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--accent), transparent) 1;
}

.doc-content h2 {
    font-family: Georgia, 'Palatino Linotype', 'Book Antiqua', serif;
    font-size: 21px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 28px;
    margin-bottom: 12px;
}

.doc-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 22px;
    margin-bottom: 10px;
}

.doc-content h4 {
    font-size: 15px;
    font-weight: 600;
    margin-top: 18px;
    margin-bottom: 8px;
}

.doc-content h5 {
    font-size: 14px;
    font-weight: 600;
    margin-top: 14px;
    margin-bottom: 6px;
}

.doc-content h6 {
    font-size: 13px;
    font-weight: 600;
    margin-top: 12px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.doc-content p {
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 14px;
}

.doc-content ul,
.doc-content ol {
    padding-left: 24px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.doc-content li {
    line-height: 1.8;
    margin-bottom: 4px;
    font-size: 14px;
}

.doc-content code {
    background: var(--code-bg);
    color: var(--accent);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.88em;
    border: 1px solid var(--border);
}

.doc-content pre {
    background: var(--code-bg);
    border: none;
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.doc-content pre code {
    background: none;
    color: var(--text-primary);
    padding: 0;
    border-radius: 0;
    font-size: 13px;
    border: none;
}

.doc-content table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    margin-bottom: 16px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.doc-content th,
.doc-content td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
    font-size: 14px;
}

.doc-content th {
    background: var(--bg-surface);
    font-weight: 600;
    color: var(--text-primary);
}

.doc-content tr:nth-child(even) td {
    background: var(--accent-glow);
}

.doc-content td {
    color: var(--text-secondary);
}

.doc-content blockquote {
    border-left: 2px solid var(--accent);
    background: var(--accent-soft);
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
}

.doc-content a {
    color: var(--accent);
    text-decoration: none;
    transition: text-decoration 0.2s var(--ease);
}

.doc-content a:hover {
    text-decoration: underline;
}

.doc-content strong {
    color: var(--text-primary);
}

.doc-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* 8. Mobile responsive
   ------------------------------------------ */
@media (max-width: 767px) {
    body {
        flex-direction: column;
    }

    .mobile-tabs {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-deep);
        border-bottom: 1px solid var(--border);
    }

    .mobile-tabs .tab {
        flex: 1;
        border: none;
        background: none;
        color: var(--text-tertiary);
        padding: 12px 0;
        font-size: 13px;
        cursor: pointer;
        text-align: center;
        transition: color 0.2s var(--ease);
        border-bottom: 2px solid transparent;
    }

    .mobile-tabs .tab.active {
        color: var(--accent);
        border-bottom-color: var(--accent);
    }

    .sidebar,
    .detail-panel,
    .doc-panel {
        display: none;
        width: 100%;
        height: calc(100vh - 46px);
        position: static;
        border: none;
    }

    .sidebar.mobile-visible {
        display: flex;
    }

    .detail-panel.mobile-visible,
    .doc-panel.mobile-visible {
        display: block;
    }

    .detail-panel {
        padding: 20px 16px;
    }

    .doc-panel {
        padding: 20px 16px;
    }

    .skill-item {
        padding: 12px 16px 12px 20px;
    }

    .detail-content h2 {
        font-size: 22px;
    }

    .detail-content {
        max-width: 100%;
    }

    .doc-content {
        max-width: 100%;
    }
}
