/* ===========================
   DevOps Cheatsheet Styling
   =========================== */

.cheatsheet-search-container {
    margin-top: 2rem;
    position: relative;
    max-width: 600px;
}

.cheatsheet-search-container input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 8px;
    background: #161b22;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

.cheatsheet-search-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(50, 108, 229, 0.2);
}

.cheatsheet-search-container .search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.cheatsheet-layout {
    display: flex;
    gap: 3rem;
    margin: 3rem auto;
    padding: 0 1.5rem 6rem;
    max-width: 1200px;
}

/* Sidebar */
.cheatsheet-sidebar {
    width: 240px;
    flex-shrink: 0;
}

#cheatsheet-nav {
    position: sticky;
    top: 100px;
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 1rem;
}

#cheatsheet-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#cheatsheet-nav a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    transition: 0.3s;
}

#cheatsheet-nav a:hover, #cheatsheet-nav a.active {
    background: #161b22;
    color: var(--text-main);
}

#cheatsheet-nav a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Content Area */
.cheatsheet-content {
    flex-grow: 1;
    min-width: 0;
}

.tool-section {
    margin-bottom: 4rem;
    scroll-margin-top: 100px;
}

.tool-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tool-header h2 {
    font-size: 2rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.tool-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Category Setup */
.cmd-category {
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.cmd-category-header {
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #161b22;
    user-select: none;
    transition: background 0.2s;
}

.cmd-category-header:hover {
    background: #1e242d;
}

.cmd-category-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cmd-count {
    font-size: 0.8rem;
    background: var(--bg-body);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.toggle-icon {
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.cmd-category.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.cmd-category.collapsed .cmd-category-body {
    display: none;
}

.cmd-category-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Command Item */
.cmd-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-body);
    padding: 1.2rem;
    transition: border-color 0.3s;
}

.cmd-item:hover {
    border-color: var(--primary);
}

.cmd-item.freq-used {
    border-left: 3px solid #f39c12;
}

.cmd-item:hover.freq-used {
    border-color: #f39c12;
}

.cmd-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
}

.cmd-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badge Categories */
.diff-beginner { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.diff-intermediate { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.diff-advanced { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }

.tag-branch { background: rgba(142, 68, 173, 0.15); color: #8e44ad; }
.tag-container { background: rgba(36, 150, 237, 0.15); color: #2496ED; }
.tag-pod { background: rgba(50, 108, 229, 0.15); color: #326CE5; }
.tag-infra { background: rgba(123, 66, 188, 0.15); color: #7B42BC; }
.tag-deploy { background: rgba(243, 156, 18, 0.15); color: #f39c12; }
.tag-debug { background: rgba(230, 126, 34, 0.15); color: #e67e22; }
.tag-repo { background: rgba(241, 80, 47, 0.15); color: #F1502F; }

.freq-badge { background: rgba(243, 156, 18, 0.15); color: #f39c12; padding-left: 0.3rem;}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.copy-btn.copied {
    color: #2ecc71;
    border-color: #2ecc71;
}

/* Code Block with Tooltip */
.cmd-code-block {
    position: relative;
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 6px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    color: #58a6ff;
    font-size: 0.95rem;
    cursor: default;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1e242d;
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: var(--font-main);
    font-size: 0.85rem;
    width: max-content;
    max-width: 300px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    line-height: 1.5;
}

.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

.tooltip-trigger:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tooltip-content strong {
    color: var(--primary);
    display: block;
    margin-bottom: 0.3rem;
}

.cmd-docs {
    font-size: 0.9rem;
    line-height: 1.6;
}

.cmd-desc {
    color: var(--text-main);
    margin-bottom: 0.8rem;
}

.cmd-example {
    background: rgba(255,255,255,0.02);
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    color: var(--text-muted);
    border-left: 2px solid var(--primary);
}

.cmd-example code {
    background: none;
    padding: 0;
    color: #a5d6ff;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 900px) {
    .cheatsheet-layout {
        flex-direction: column;
        gap: 2rem;
    }

    .cheatsheet-sidebar {
        width: 100%;
    }

    #cheatsheet-nav {
        position: static;
        padding: 1rem;
    }
    
    #cheatsheet-nav ul {
        flex-direction: row;
        flex-wrap: wrap;
    }

    #cheatsheet-nav li {
        flex: 1 1 120px;
    }
}
