/**
 * TP Sidebar — service navigation, CTA, docs
 *
 * @package Technoproekt
 * @author  Kkalganov <https://kkalganov.com>
 */

/* ==========================================================================
   Sidebar
   ========================================================================== */

/* Sticky positioning is applied on .tp-content-sidebar > .e-con-inner
   (see service-detail.css), not on .tp-sidebar itself, because Elementor's
   e-con-boxed wrapper creates an extra div that breaks sticky if applied here. */
.tp-sidebar {
    order: -1;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.tp-sidebar__nav {
    background: var(--tp-white);
    border: 1px solid var(--tp-cream-warm);
    margin-bottom: 24px;
}

.tp-sidebar__nav-title {
    padding: 22px 24px;
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--tp-white);
    background: linear-gradient(135deg, var(--tp-green-main) 0%, var(--tp-green-dark) 100%);
    border-bottom: 3px solid var(--tp-yellow);
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-sidebar__nav-title svg {
    width: 22px;
    height: 22px;
    color: var(--tp-yellow);
}

/* ==========================================================================
   Service items (level 1)
   ========================================================================== */

.tp-sidebar__service {
    border-bottom: 1px solid var(--tp-cream);
}

.tp-sidebar__service:last-child {
    border-bottom: none;
}

/* Header wrapper for L1 items with children (link + toggle) */
.tp-sidebar__service-header {
    display: flex;
    align-items: center;
    border-bottom: none;
}

.tp-sidebar__service-header .tp-sidebar__service-link {
    flex: 1;
    min-width: 0;
}

.tp-sidebar__service-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tp-text);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    text-decoration: none;
}

.tp-sidebar__service-link:hover {
    background: var(--tp-cream);
    color: var(--tp-green-main);
}

/* Current page — strong highlight */
.tp-sidebar__service-link.is-active {
    color: var(--tp-green-main);
    font-weight: 600;
    background: var(--tp-sidebar-active-bg);
    border-left: 3px solid var(--tp-green-main);
}

/* Ancestor of current page — green text only, accordion open is enough visual cue */
.tp-sidebar__service-link.is-active-ancestor {
    color: var(--tp-green-main);
    font-weight: 600;
}

/* Toggle button for expanding/collapsing L1 sub-services */
.tp-sidebar__service-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    flex-shrink: 0;
    align-self: stretch;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--tp-text-light);
    transition: all 0.2s;
}

.tp-sidebar__service-toggle:hover {
    background: var(--tp-cream);
    color: var(--tp-green-main);
}

.tp-sidebar__service-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.3s;
    flex-shrink: 0;
}

.tp-sidebar__service.is-open .tp-sidebar__service-arrow {
    transform: rotate(180deg);
    color: var(--tp-green-main);
}

/* ==========================================================================
   Sub-services (level 2)
   ========================================================================== */

.tp-sidebar__service-subs {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tp-sidebar__service.is-open > .tp-sidebar__service-subs {
    max-height: 600px;
}

/* Header wrapper for L2 items with children (link + toggle) */
.tp-sidebar__sub-header {
    display: flex;
    align-items: center;
}

.tp-sidebar__sub-header .tp-sidebar__sub-link {
    flex: 1;
    min-width: 0;
}

.tp-sidebar__sub-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px 8px 32px;
    font-size: 12px;
    color: var(--tp-text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.tp-sidebar__sub-link:hover {
    color: var(--tp-green-main);
}

/* Current page — strong highlight */
.tp-sidebar__sub-link.is-active {
    color: var(--tp-green-main);
    font-weight: 600;
    background: var(--tp-sidebar-active-bg);
    border-left: 3px solid var(--tp-green-main);
    padding-left: 29px;
}

/* Ancestor of current page — green text only */
.tp-sidebar__sub-link.is-active-ancestor {
    color: var(--tp-green-main);
}

.tp-sidebar__sub-link::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--tp-cream-warm);
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.2s;
}

.tp-sidebar__sub-link:hover::before,
.tp-sidebar__sub-link.is-active::before,
.tp-sidebar__sub-link.is-active-ancestor::before {
    background: var(--tp-green-main);
}

.tp-sidebar__service-subs li:last-child .tp-sidebar__sub-link {
    padding-bottom: 12px;
}

/* Toggle button for expanding/collapsing L2 sub-sub-services */
.tp-sidebar__sub-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    flex-shrink: 0;
    align-self: stretch;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--tp-text-light);
    transition: all 0.2s;
    padding: 0 8px 0 0;
}

.tp-sidebar__sub-toggle:hover {
    color: var(--tp-green-main);
}

/* ==========================================================================
   Sub-sub-services (level 3)
   ========================================================================== */

.tp-sidebar__sub-item {
    position: relative;
}

.tp-sidebar__sub-link--parent {
    cursor: pointer;
}

.tp-sidebar__sub-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.3s;
    flex-shrink: 0;
    color: var(--tp-text-light);
    margin-left: auto;
}

.tp-sidebar__sub-item.is-open .tp-sidebar__sub-arrow {
    transform: rotate(180deg);
    color: var(--tp-green-main);
}

.tp-sidebar__sub-subs {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tp-sidebar__sub-item.is-open > .tp-sidebar__sub-subs {
    max-height: 400px;
}

.tp-sidebar__sub-sub-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 20px 6px 50px;
    font-size: 11px;
    color: var(--tp-text-light);
    text-decoration: none;
    transition: all 0.2s;
}

.tp-sidebar__sub-sub-link:hover {
    color: var(--tp-green-main);
}

.tp-sidebar__sub-sub-link.is-active {
    color: var(--tp-green-main);
    font-weight: 600;
    background: var(--tp-sidebar-active-bg);
    border-left: 3px solid var(--tp-green-main);
    padding-left: 47px;
}

.tp-sidebar__sub-sub-link::before {
    content: '';
    width: 8px;
    height: 1px;
    background: var(--tp-cream-warm);
    flex-shrink: 0;
    transition: background 0.2s;
}

.tp-sidebar__sub-sub-link:hover::before,
.tp-sidebar__sub-sub-link.is-active::before {
    background: var(--tp-green-main);
}

/* ==========================================================================
   CTA block
   ========================================================================== */

.tp-sidebar__cta {
    background: linear-gradient(135deg, var(--tp-green-main) 0%, var(--tp-green-dark) 100%);
    padding: 32px 24px;
    text-align: center;
    margin-bottom: 24px;
}

.tp-sidebar__cta-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.tp-sidebar__cta-icon svg {
    width: 24px;
    height: 24px;
    color: var(--tp-yellow);
}

.tp-sidebar__cta h4 {
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--tp-white);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.tp-sidebar__cta p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 20px;
}

.tp-sidebar__cta-phone {
    display: block;
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--tp-yellow);
    text-decoration: none;
    margin-bottom: 16px;
    transition: color 0.2s;
}

.tp-sidebar__cta-phone:hover {
    color: var(--tp-yellow-bright);
}

.tp-sidebar__cta-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: var(--tp-yellow);
    color: var(--tp-dark);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 93% 100%, 0 100%);
    transition: background 0.3s;
    text-align: center;
    text-decoration: none;
}

.tp-sidebar__cta-btn:hover {
    background: var(--tp-yellow-bright);
}

/* ==========================================================================
   Docs block
   ========================================================================== */

.tp-sidebar__docs {
    background: var(--tp-white);
    border: 1px solid var(--tp-cream-warm);
    padding: 24px;
}

.tp-sidebar__docs-title {
    font-family: 'Unbounded', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--tp-text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tp-sidebar__docs-title svg {
    width: 18px;
    height: 18px;
    color: var(--tp-green-main);
}

.tp-sidebar__doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--tp-cream);
    font-size: 13px;
    color: var(--tp-text-light);
}

.tp-sidebar__doc-item:last-child {
    border-bottom: none;
}

.tp-sidebar__doc-item svg {
    width: 16px;
    height: 16px;
    color: var(--tp-green-accent);
    flex-shrink: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .tp-sidebar {
        display: none;
    }
}
