/* --- BASE SIDEBAR --- */
.sc-sidebar {
    background: #09090b;
    border-right: 1px solid #27272a;
    display: flex;
    flex-direction: column;
    height: 100%;
    user-select: none;
}

/* --- HEADER --- */
.sc-header {
    padding: 16px;
    border-bottom: 1px solid #1a1a1c;
}
.sc-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sc-title {
    font-size: 11px;
    font-weight: 700;
    color: #52525b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sc-actions {
    display: flex;
    gap: 12px;
}
.sc-icon-btn {
    cursor: pointer;
    font-size: 12px;
    color: #71717a;
    transition: color 0.2s;
}
.sc-icon-btn:hover { color: #fff; }

.sc-search-wrapper { margin-top: 10px; }
.sc-hidden { display: none !important; }

/* --- TREE VIEWPORT --- */
.sc-tree-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

/* Custom Scrollbar */
.sc-custom-scroll::-webkit-scrollbar { width: 8px; background: #09090b; }
.sc-custom-scroll::-webkit-scrollbar-track { background: #09090b; }
.sc-custom-scroll::-webkit-scrollbar-thumb {
    background-color: #27272a; 
    border-radius: 10px; 
    border: 2px solid #09090b;
}
.sc-custom-scroll::-webkit-scrollbar-thumb:hover { background-color: #3f3f46; }

/* --- BRANCH & NODE STYLING --- */
.sc-branch { margin-bottom: 4px; }
.sc-branch-head {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    gap: 10px;
    cursor: pointer;
    transition: background 0.1s;
}
.sc-branch-head:hover { background: #18181b; }
.sc-branch.sc-active > .sc-branch-head { background: #0c0c0e; }

.sc-toggle-icon { font-size: 10px; color: #52525b; width: 12px; transition: transform 0.2s; }
.sc-star { font-size: 11px; color: #3f3f46; }
.sc-star.sc-fav { color: #eab308; }
.sc-branch-name { font-size: 13px; font-weight: 500; flex: 1; color: #d4d4d8; }

.sc-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #3f3f46; }
.sc-status-dot.sc-online { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }

/* Branch Content */
.sc-branch-body {
    margin-left: 22px;
    border-left: 1px solid #1a1a1c;
    padding-left: 12px;
    margin-top: 4px;
}

.sc-tree-node {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #71717a;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.sc-tree-node:hover { background: #18181b; color: #d4d4d8; }
.sc-tree-node.sc-selected { background: #111114; color: #3b82f6; font-weight: 500; }

/* Drag and Drop Visual Feedback */
.sc-tree-node.sc-dragging { opacity: 0.4; }
.sc-branch.sc-drag-over { background: rgba(59, 130, 246, 0.05); outline: 1px dashed #3b82f6; }

.sc-node-icon { font-size: 12px; width: 14px; text-align: center; }
.sc-play-icon { font-size: 10px; color: #10b981; margin-left: auto; }
.sc-meta-label { font-size: 9px; color: #3f3f46; text-transform: uppercase; font-weight: 700; margin: 10px 0 4px 8px; letter-spacing: 0.5px; }

/* --- FOOTER --- */
.sc-footer {
    padding: 12px 16px;
    border-top: 1px solid #1a1a1c;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sc-footer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: #71717a;
    cursor: pointer;
    padding: 6px 0;
}
.sc-footer-link:hover { color: #fff; }
.sc-footer-link i { font-size: 14px; width: 16px; }

/* --- MODAL --- */
.sc-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.sc-modal-box {
    background: #09090b;
    border: 1px solid #27272a;
    width: 320px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.sc-modal-head { padding: 16px; border-bottom: 1px solid #1a1a1c; display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; }
.sc-modal-body { padding: 16px; }
.sc-form-label { display: block; font-size: 11px; color: #71717a; margin-bottom: 8px; text-transform: uppercase; }
.sc-input-field { width: 100%; background: #18181b; border: 1px solid #27272a; color: #fff; padding: 10px; border-radius: 6px; font-size: 13px; outline: none; }
.sc-input-field:focus { border-color: #3b82f6; }
.sc-modal-foot { padding: 12px 16px; background: #0c0c0e; display: flex; justify-content: flex-end; gap: 8px; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.sc-btn { padding: 8px 16px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; }
.sc-btn-primary { background: #3b82f6; color: white; }
.sc-btn-secondary { background: transparent; color: #a1a1aa; }

/* --- UPDATED: Detailed Library Modal Styling (Date Removed) --- */

/* Main scrollable container */
.sc-modal-bot-list {
    max-height: 320px; 
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 6px;
}

/* Individual Bot Item Card */
.sc-bot-library-item.detailed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #0d0d0f;
    border: 1px solid #1a1a1c;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Left Content: Icon + Text Group */
.lib-info-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.lib-info-left i {
    font-size: 16px;
    color: #52525b;
    transition: color 0.2s;
}

.lib-text-group {
    display: flex;
    flex-direction: column;
    /* Removed gap as there is only one line now */
}

.lib-name {
    font-size: 13px;
    font-weight: 600;
    color: #e4e4e7;
    transition: color 0.2s;
}

/* Right Content: Checkbox Indicator */
.lib-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #27272a;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #09090b;
    transition: all 0.2s;
}

.lib-checkbox i {
    font-size: 10px;
    color: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}

/* --- STATES --- */

/* Hover State */
.sc-bot-library-item.detailed:hover {
    background: #18181b;
    border-color: #3f3f46;
}

.sc-bot-library-item.detailed:hover .lib-name {
    color: #fff;
}

/* Active / Selected State */
.sc-bot-library-item.detailed.active {
    background: #111114;
    border-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
}

.sc-bot-library-item.detailed.active .lib-name,
.sc-bot-library-item.detailed.active .lib-info-left i {
    color: #3b82f6;
}

.sc-bot-library-item.detailed.active .lib-checkbox {
    background: #3b82f6;
    border-color: #3b82f6;
}

.sc-bot-library-item.detailed.active .lib-checkbox i {
    opacity: 1;
    transform: scale(1);
}

/* Empty State Message */
.sc-empty-msg {
    padding: 30px 20px;
    text-align: center;
    font-size: 12px;
    color: #52525b;
    border: 1px dashed #27272a;
    border-radius: 8px;
}

/* Custom Scrollbar for Modal List */
.sc-modal-bot-list::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}

.sc-modal-bot-list::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 10px;
}

.sc-modal-bot-list::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

/* --- Tree Branch Action Area --- */
.sc-branch-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto; /* Pushes to far right */
    width: 20px;       /* Fixed width to prevent content jumping */
    position: relative;
}

/* Default Status Dot */
.sc-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3f3f46; /* sc-idle */
    transition: opacity 0.15s;
}

.sc-status-dot.sc-online {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* Trash Icon inside Branch */
.sc-btn-delete-client {
    position: absolute;
    font-size: 11px;
    color: #52525b;
    cursor: pointer;
    opacity: 0;         /* Hidden by default */
    transition: opacity 0.15s, color 0.15s;
}

.sc-btn-delete-client:hover {
    color: #f87171;
}

/* HOVER TOGGLE: Status Dot -> Trash Bin */
.sc-branch-head:hover .sc-status-dot {
    opacity: 0;
}

.sc-branch-head:hover .sc-btn-delete-client {
    opacity: 1;
}

/* --- Bot Node Actions --- */
.sc-node-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto; /* Pushes to far right */
}

.sc-btn-delete-bot {
    font-size: 11px;
    color: #52525b;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.sc-btn-delete-bot:hover {
    color: #f87171;
}

.sc-tree-node:hover .sc-btn-delete-bot {
    opacity: 1;
}

/* --- Global Modal Constraints --- */
#sc-modal-overlay .sc-modal-box {
    width: auto; /* Required as per request */
    min-width: 450px; /* Ensures table has breathing room */
    max-width: 90vw;
}

/* --- Balanced Pricing Table --- */
.sc-pricing-table {
    width: 100%;
    border: 1px solid #1a1a1c;
    border-radius: 4px;
    overflow: hidden;
    background: #09090b;
    margin-top: 10px;
}

.prc-row {
    display: grid;
    /* Balanced Leveling: Labels get 100px, tiers share remaining space equally */
    grid-template-columns: 100px repeat(4, 1fr); 
    border-bottom: 1px solid #1a1a1c;
}

.prc-row:last-child { border-bottom: none; }

.prc-cell {
    padding: 14px 10px;
    font-size: 11px;
    border-right: 1px solid #1a1a1c;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #a1a1aa;
    white-space: nowrap;
}

.prc-cell:last-child { border-right: none; }

.prc-header-row { 
    background: #0d0d0f; 
    font-weight: 700; 
    color: #fff; 
    text-transform: uppercase;
}

.prc-label { 
    justify-content: flex-start; 
    background: #0d0d0f; 
    color: #52525b; 
    font-weight: 700; 
    font-size: 10px;
    padding-left: 12px;
}

.prc-vision-col { 
    background: rgb(234 119 255 / 4%);
    border-left: 1px solid #ae3bf6;
    border-right: 1px solid #ae3bf6 !important;
    color: #fff;
    font-weight: 700;
}

.prc-btn-rect {
    width: 100%;
    background: #18181b;
    border: 1px solid #27272a;
    color: #fff;
    padding: 8px 4px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
}

.prc-btn-vision { 
    background: #6b258f;
    border-color: #815995;
 }

/* --- Restored Help Styling --- */
.sc-help-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px 5px;
}

.help-section h4 { font-size: 14px; color: #fff; margin-bottom: 6px; }
.help-section p { font-size: 12px; line-height: 1.6; color: #a1a1aa; margin: 0; }

.help-note-box {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    gap: 15px;
}

.help-note-box i { color: #3b82f6; font-size: 18px; margin-top: 2px; }
.help-note-box strong { color: #3b82f6; display: block; margin-bottom: 4px; font-size: 13px; }
.help-note-box p { font-size: 12px; color: #a1a1aa; line-height: 1.5; margin: 0; }

/* Target the modal box only when it contains the help documentation */
#sc-modal-overlay:has(.sc-help-content) .sc-modal-box {
    width: 450px !important;
    min-width: 450px !important;
}

/* Restored Help Styling to ensure content fills the 450px width */
.sc-help-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px 5px;
}

.help-note-box {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    gap: 15px;
}

.help-note-box i { 
    color: #3b82f6; 
    font-size: 18px; 
    margin-top: 2px; 
}

.help-note-box strong { 
    color: #3b82f6; 
    display: block; 
    margin-bottom: 4px; 
    font-size: 13px; 
}

.help-note-box p { 
    font-size: 12px; 
    color: #a1a1aa; 
    line-height: 1.5; 
    margin: 0; 
}

.sc-footer a.sc-footer-link {
    text-decoration: none;
}

/* --- New: Create Bot Action Item --- */
.sc-bot-library-item.create-action {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the content */
    padding: 12px 16px;
    background: rgba(9, 9, 11, 0.5);
    border: 1px dashed #3f3f46;
    border-radius: 8px;
    cursor: pointer;
    color: #60a5fa; /* Light Blue Text */
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px; /* Spacing between button and list */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sc-bot-library-item.create-action:hover {
    background: rgba(59, 130, 246, 0.08); /* Subtle blue fill on hover */
    border-color: #3b82f6; /* Solid blue border on hover */
    transform: translateY(-1px); /* Slight lift effect */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sc-bot-library-item.create-action:active {
    transform: translateY(0);
    opacity: 0.9;
}

.sc-bot-library-item.create-action i {
    font-size: 12px;
    margin-right: 8px;
    transition: transform 0.2s;
}

.sc-bot-library-item.create-action:hover i {
    transform: rotate(90deg); /* Playful rotation on hover */
}