/* cket_documentation/static/src/css/documentation.css */

/* Reset and base layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Main wrapper - flex layout for sidebar + right panel */
.documentation-main-wrapper {
    display: flex;
    align-items: flex-start;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar - full height from top to bottom - always visible */
.docs-sidebar-full {
    position: sticky;
    top: 0;
    align-self: flex-start;
    width: 260px;
    min-width: 180px;
    max-width: 400px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 16px 12px;
    overflow-y: auto;
    height: 100vh;
}

.docs-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Custom scrollbar for sidebar */
.docs-sidebar-full::-webkit-scrollbar {
    width: 6px;
}

.docs-sidebar-full::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 3px;
}

.docs-sidebar-full::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.docs-sidebar-full::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Sidebar Items */
.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    padding: 12px 12px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 8px;
}

/* Main menu item container */
.sidebar-main-item {
    margin-bottom: 4px;
}

/* Wrapper for items WITH children (clickable dropdown) */
.sidebar-main-link-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.sidebar-main-link-wrapper:hover {
    background: linear-gradient(90deg, #f1f5f9 0%, #ffffff 100%);
    transform: translateX(3px);
}

.sidebar-main-link-wrapper .sidebar-main-link {
    flex: 1;
    padding: 10px 12px;
}

/* Items WITHOUT children - direct links */
.sidebar-main-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #334155;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    gap: 8px;
}

.sidebar-main-link:hover {
    background: linear-gradient(90deg, #f1f5f9 0%, #ffffff 100%);
    color: #668cff;
    transform: translateX(3px);
}

.menu-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

/* Dropdown Icon */
.dropdown-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
    color: #668cff;
    flex-shrink: 0;
}

.dropdown-icon:hover {
    background: rgba(102, 140, 255, 0.1);
}

.dropdown-icon i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

/* Submenu styles */
.sidebar-submenu {
    display: none;
    padding-left: 32px;
    margin-top: 4px;
    margin-bottom: 4px;
}

.sidebar-submenu.show {
    display: block;
}

.sidebar-submenu.level-2 {
    padding-left: 20px;
}

/* Submenu items */
.sidebar-sub-link {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 13px;
    border-radius: 8px;
    gap: 8px;
    margin: 2px 0;
}

.sidebar-sub-link:hover {
    background: linear-gradient(90deg, #f1f5f9 0%, #ffffff 100%);
    color: #668cff;
    transform: translateX(3px);
    padding-left: 15px;
}

.sidebar-sub-link i {
    width: 16px;
    font-size: 12px;
}

.sidebar-sub-link.level-2-link {
    padding-left: 20px;
    font-size: 12px;
}

/* Submenu items with dual actions */
.sidebar-sub-link-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.sidebar-sub-link-wrapper .sidebar-sub-link {
    flex: 1;
    padding: 8px 12px;
}

.sub-dropdown-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* Active states */
.sidebar-main-link.active,
.sidebar-sub-link.active {
    background: linear-gradient(90deg, #eff6ff 0%, #ffffff 100%);
    color: #668cff;
    font-weight: 600;
    border-left: 3px solid #668cff;
}

/* Nested items */
.sidebar-sub-item {
    margin: 2px 0;
}

/* Header styles */
.docs-header {
    background: #668cff !important;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.docs-header.header-hidden {
    transform: translateY(-100%);
}

.docs-header.header-visible {
    transform: translateY(0);
}

.hero-section {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    text-align: center;
}

.hero-content h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: white;
}

.hero-content p {
    font-size: 14px;
    color: white;
    opacity: 0.95;
    margin-bottom: 0;
}

/* Sidebar Top Actions */
.sidebar-top-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
}

.search-form-sidebar {
    display: flex;
    flex: 1;
    gap: 8px;
    min-width: 0;
}

.search-form-sidebar input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
}

.search-form-sidebar input:focus {
    outline: none;
    border-color: #668cff;
    box-shadow: 0 0 0 3px rgba(102, 140, 255, 0.1);
}

.sidebar-search-btn,
.sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #668cff;
    color: white;
    border: none;
    border-radius: 8px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s;
}

.sidebar-search-btn:hover,
.sidebar-toggle-btn:hover {
    background: #4a6fe0;
    transform: scale(1.05);
}

.sidebar-title {
    margin-bottom: 16px;
}

.sidebar-title h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #668cff;
}

.sidebar-title a {
    text-decoration: none;
}

/* Main Content */
.docs-main-full {
    flex: 1;
    padding: 40px;
    background: #ffffff;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.homepage-title {
    font-size: 32px;
    color: #1e293b;
    margin-bottom: 10px;
}

.homepage-subtitle {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 30px;
}

.page-title {
    font-size: 28px;
    color: #1e293b;
    margin-bottom: 20px;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-color: #668cff;
}

.card i {
    font-size: 36px;
    color: #668cff;
    margin-bottom: 15px;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.card p {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

/* Image styles */
.documentation-image-container {
    margin: 25px 0;
    text-align: center;
}

.documentation-image-container img {
    max-width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border: 1px solid #e2e8f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 8px;
    cursor: pointer;
}

.documentation-image-container img:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

/* Navigation */
.doc-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.doc-nav a {
    padding: 8px 16px;
    background: #f1f5f9;
    color: #668cff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.doc-nav a:hover {
    background: #668cff;
    color: white;
    transform: translateX(3px);
}

/* Resize Handle - SINGLE VERSION */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 100;
    transition: background 0.2s;
}

.sidebar-resize-handle:hover {
    background: rgba(102, 140, 255, 0.3);
}

.sidebar-resize-handle:active {
    background: rgba(102, 140, 255, 0.5);
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: #cbd5e1;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.sidebar-resize-handle:hover::after {
    opacity: 1;
}

/* Visual indicator while dragging */
body.resizing-sidebar {
    cursor: col-resize !important;
    user-select: none !important;
}

body.resizing-sidebar .docs-sidebar-full {
    transition: none;
}

body.resizing-sidebar .sidebar-resize-handle {
    background: rgba(102, 140, 255, 0.7);
}

/* Sidebar Collapse Functionality */
body.sidebar-collapsed .docs-sidebar-full {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: none;
}

body.sidebar-collapsed .sidebar-resize-handle {
    display: none;
}

body.sidebar-collapsed .sidebar-open-btn {
    display: block;
}

body.sidebar-collapsed .sidebar-toggle-btn {
    display: none;
}

body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .sidebar-top-actions,
body.sidebar-collapsed .sidebar-section,
body.sidebar-collapsed .sidebar-menu-container {
    display: none;
}

/* When sidebar is visible, show resize handle */
body:not(.sidebar-collapsed) .sidebar-resize-handle {
    display: block;
}

/* Open button - appears when sidebar is collapsed */
.sidebar-open-btn {
    position: fixed;
    top: 90px;
    left: 10px;
    z-index: 1002;
    background: #668cff;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.sidebar-open-btn:hover {
    background: #4a6fe0;
    transform: scale(1.05);
}

/* Alert styles */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.alert-info {
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    color: #0369a1;
}

/* Search Results */
.search-results-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.search-results-header i {
    font-size: 32px;
    color: #668cff;
}

.search-results-header h2 {
    margin: 0;
    font-size: 24px;
    color: #1e293b;
}

.results-count {
    color: #64748b;
    margin-bottom: 30px;
    font-size: 14px;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-result-item {
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.search-result-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #668cff;
}

.search-result-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    margin-bottom: 10px;
}

.search-result-item a i {
    font-size: 20px;
    color: #668cff;
}

.search-result-item a h3 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
}

.search-result-item a:hover h3 {
    color: #668cff;
}

.search-result-item p {
    margin: 0;
    padding-left: 32px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .docs-sidebar-full {
        width: 280px !important;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        height: 100vh;
        transform: translateX(0);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    body.sidebar-collapsed .docs-sidebar-full {
        transform: translateX(-100%);
        width: 280px !important;
    }
    
    body.sidebar-collapsed .sidebar-title,
    body.sidebar-collapsed .sidebar-top-actions,
    body.sidebar-collapsed .sidebar-section {
        display: block;
    }
    
    body.sidebar-collapsed .sidebar-open-btn {
        display: flex;
    }
    
    .docs-main-full {
        padding: 20px;
    }
    
    .content-wrapper {
        max-width: 100%;
    }
    
    .documentation-image-container img {
        max-height: 250px;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-content h1 {
        font-size: 20px;
    }
    
    .hero-content p {
        font-size: 12px;
    }
}