/* Do Tank Admin Menu - Independent Menu Styles
 * Uses dtam- prefixed classes for theme independence
 * Compatible with BuddyBoss containers but not dependent on BuddyBoss CSS
 */

/* ===================================
   Custom CSS Variables (Independent from BuddyBoss)
   =================================== */

:root {
    --dtam-panel-background: #1a1a2e;
    --dtam-link-color: #b8b8d1;

    --dtam-active-color: #4facfe;
    --dtam-active-bg: rgba(79, 172, 254, 0.1);
    --dtam-active-count-bg: #4facfe;
    --dtam-active-count-color: #fff;

    /* Hover Defaults (Generated by PHP, but fallback here) */
    --dtam-hover-color: #4facfe;
    --dtam-link-hover-bg: rgba(79, 172, 254, 0.05);
}

/* ===================================
   Hide Conflicting Theme Elements
   =================================== */

/* Hide BuddyBoss mobile header when our menu is active */
body.dtam-menu-active .bb-mobile-header,
body.dtam-menu-active .bb-mobile-panel-toggle,
body.dtam-menu-active #bb-mobile-menu-toggle {
    display: none !important;
}

/* ===================================
   Independent Side Panel Container
   =================================== */

.dtam-panel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background-color: var(--dtam-panel-background);
    z-index: 9999;
    /* Flexbox for fixed header/footer and scrolling middle */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent double scrollbar on container */
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    padding: 0;
    /* Removing padding from container to let inner handle it */
}

.dtam-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    /* Ensure inner content doesn't spill */
    padding: 10px;
    box-sizing: border-box;
}

.dtam-logo {
    padding: 40px 20px 20px 20px;
    /* Increased top padding to move logo down and avoid admin bar crop */
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin: -10px -10px 20px -10px;
    /* Negative margin to extend background to panel edges */
    flex-shrink: 0;
    /* Prevent shrinking */
    position: relative;
    /* For background image positioning */
    overflow: hidden;
    /* Contain background image */
}

.dtam-logo-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    /* Behind content */
}

.dtam-logo a {
    display: inline-block;
    text-decoration: none;
    position: relative;
    z-index: 1;
    /* Above background */
}

.dtam-logo-img {
    max-width: 80px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.dtam-site-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--dtam-link-color);
}

.dtam-menu-container {
    flex: 1;
    /* Take remaining space */
    overflow-y: auto;
    /* Scroll ONLY this area */
    overflow-x: hidden;
    min-height: 0;
    /* Firefox flex fix */
}

/* Footer Badge */
.dtam-footer {
    padding: 95px 20px 20px 20px;
    /* Expanded footer area with badge pushed down toward bottom */
    text-align: center;
    margin: auto -10px -10px -10px;
    /* Negative margin to extend background to panel edges */
    flex-shrink: 0;
    position: relative;
    /* For background image positioning */
    overflow: hidden;
    /* Contain background image */
}

.dtam-footer-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    /* Behind content */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30px);
    mask-image: linear-gradient(to bottom, transparent 0%, black 30px);
    /* Feathered fade from transparent at top edge */
}

.dtam-powered-by {
    display: inline-block;
    text-decoration: none;
    opacity: 0.7;
    position: relative;
    z-index: 1;
    /* Above background */
    transition: opacity 0.3s ease;
}

.dtam-powered-by:hover {
    opacity: 1;
}

.dtam-grapevine-logo {
    max-width: 180px;
    /* Increased size */
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Mobile Toggle Button */
.dtam-toggle {
    display: none;
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 10000;
    background: var(--dtam-active-color);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    padding: 0 !important;
    /* Override Elementor/Theme padding */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

body.admin-bar .dtam-toggle {
    top: 70px;
    /* 46px admin bar + 24px */
}

.dtam-toggle:hover {
    background: var(--dtam-active-color);
    transform: scale(1.05);
}

.dtam-toggle-icon {
    display: block;
    position: relative;
    width: 26px;
    /* Increased from 20px */
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.dtam-toggle-icon::before,
.dtam-toggle-icon::after {
    content: '';
    position: absolute;
    width: 26px;
    /* Increased from 20px */
    height: 2px;
    background: #fff;
    left: 0;
    border-radius: 2px;
    /* Smooth ends */
    transition: all 0.3s ease;
}

.dtam-toggle-icon::before {
    top: -8px;
    /* Increased from -6px */
}

.dtam-toggle-icon::after {
    top: 8px;
    /* Increased from 6px */
}

/* Toggle active state (X shape) */
.dtam-panel-open .dtam-toggle-icon {
    background: transparent;
}

.dtam-panel-open .dtam-toggle-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.dtam-panel-open .dtam-toggle-icon::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Legacy BuddyBoss Container Support (if BuddyBoss theme is still active) */
.buddypanel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background-color: var(--dtam-panel-background);
    z-index: 9999;
    overflow-y: hidden;
    /* Changed to hidden to prevent double scroll */
    overflow-x: hidden;
    transition: transform 0.3s ease;
    box-shadow: none;
    padding-left: 10px;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
}

.side-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.side-panel-menu-container {
    flex: 1;
    overflow-y: auto;
}

/* ===================================
   Do Tank Admin Menu - Independent Styles
   =================================== */

/* Menu List */
.dtam-menu.dtam-side-menu {
    list-style: none;
    margin: 0;
    padding: 10px 0;
}

.dtam-menu-item {
    min-height: 50px;
    margin-bottom: 8px;
}

.dtam-menu-link {
    display: flex;
    align-items: center;
    padding: 13px 15px;
    width: calc(100% - 20px);
    border-radius: 6px;
    color: var(--dtam-link-color);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    box-sizing: border-box;
    margin: 0 auto;
}

/* Icons - Material Icons Outlined */
.dtam-icon {
    font-size: 24px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

/* Override VinePoster's global material-icons-outlined size for menu icons only */
.dtam-menu .material-icons-outlined.dtam-icon {
    font-size: 24px !important;
}

.dtam-menu>.dtam-menu-item>.dtam-menu-link>.dtam-icon~span:not(.count) {
    margin-left: 4px;
    vertical-align: middle;
}

/* Hover State */
.dtam-menu-item:not(.dtam-current-item)>.dtam-menu-link:hover {
    background-color: var(--dtam-link-hover-bg);
    color: var(--dtam-hover-color);
}

.dtam-menu-item:not(.dtam-current-item)>.dtam-menu-link:hover .dtam-icon {
    color: var(--dtam-hover-color);
}

.dtam-menu-item:not(.dtam-current-item)>.dtam-menu-link:hover i {
    color: var(--dtam-hover-color);
}

/* Active/Current Menu Item */
.dtam-menu-item.dtam-current-item>.dtam-menu-link {
    background-color: var(--dtam-active-bg);
    color: var(--dtam-active-color);
}

.dtam-menu-item.dtam-current-item>.dtam-menu-link span.count {
    background-color: var(--dtam-active-count-bg);
    color: var(--dtam-active-count-color);
}

.dtam-menu-item.dtam-current-item>.dtam-menu-link,
.dtam-menu-item.dtam-current-item>.dtam-menu-link i,
.dtam-menu-item.dtam-current-item>.dtam-menu-link .dtam-icon {
    color: var(--dtam-active-color);
}

.dtam-menu-item.dtam-current-item>.dtam-menu-link:hover i {
    color: var(--dtam-active-color);
}

/* Icon opacity for non-active items */
.buddypanel-open .buddypanel .side-panel-inner .dtam-menu-item:not(.dtam-current-item) .dtam-menu-link i:not(.bb-icon-angle-down) {
    opacity: 0.5;
}

.buddypanel-open .buddypanel .side-panel-inner .dtam-menu-item.dtam-current-item>.dtam-menu-link>i:not(.bb-icon-angle-down) {
    opacity: 1;
}

/* Submenu Styles */
.dtam-submenu {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: transparent;
}

.dtam-has-children.open>.dtam-submenu {
    display: block;
}

.dtam-submenu .dtam-menu-item {
    margin-bottom: 0;
    min-height: 40px;
}

.dtam-submenu .dtam-menu-link {
    padding-left: 30px;
    /* Base 15px + 15px indent */
    font-size: 0.95em;
}

/* Indent deeper levels */
.dtam-submenu .dtam-submenu .dtam-menu-link {
    padding-left: 45px;
}

/* Arrow Icon */
.dtam-arrow {
    margin-left: auto;
    font-size: 20px;
    transition: transform 0.3s ease;
    margin-right: 10px;
}

.dtam-has-children.open>.dtam-menu-link .dtam-arrow {
    transform: rotate(180deg);
}

.dtam-menu-item.dtam-current-item .dtam-submenu .dtam-menu-item.dtam-current-item>.dtam-menu-link {
    background-color: var(--dtam-active-bg);
    color: var(--dtam-active-color);
}

/* ===================================
   Custom Theme Overrides
   =================================== */

/* Center Align Menu Icon */
.site-title {
    text-align: center;
}

.site-header-container {
    max-width: 100% !important;
    box-shadow: none !important;
}

#masthead::before {
    box-shadow: none !important;
}

#masthead {
    border: none !important;
    box-shadow: none !important;
}

/* Page Offset for Desktop */
@media only screen and (min-width: 1024px) {
    #page {
        margin-left: 280px !important;
    }
}

/* For overriding paragraphs in elementor text */
.p-no-marg p {
    margin-bottom: 0px !important;
}

.search-results-header h1 {
    font-size: 30px !important;
}

/* ===================================
   Scrollbar Styling
   =================================== */

/* Apply to the specific scrolling container */
.dtam-menu-container::-webkit-scrollbar {
    width: 6px;
}

.dtam-menu-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.dtam-menu-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.dtam-menu-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

@media (max-width: 1023px) {

    /* Show mobile toggle button */
    .dtam-toggle {
        display: flex;
    }

    /* Hide panel by default on mobile */
    .dtam-panel {
        transform: translateX(-100%);
        width: 100%;
        /* Full Width Overlay */
        max-width: 100%;
        box-shadow: none;
        z-index: 9998;
        /* Just below toggle */
    }

    /* Show panel when open */
    body.dtam-panel-open .dtam-panel {
        transform: translateX(0) !important;
        visibility: visible !important;
    }

    /* Add overlay when panel is open */
    /* Not needed as panel is full width, but kept if user wants partial width later.
       For full width, we don't need a backdrop necessarily, but let's keep it safe. */
    body.dtam-panel-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
    }

    /* Legacy BuddyBoss mobile support */
    .buddypanel {
        transform: translateX(-100%);
    }

    .buddypanel.mobile-open {
        transform: translateX(0);
    }

    #page {
        margin-left: 0 !important;
    }
}