/* Sidebar Menu Styles - Used by skater_menu, academy_menu, admin_menu fragments */

.sidebar-menu-container {
    position: relative;
}

/* Toggle Button */
.sidebar-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(230, 126, 34, 0.3);
}

.sidebar-menu-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.4);
}

.sidebar-menu-toggle i {
    font-size: 16px;
}

/* Slide-out Menu Pane */
.sidebar-menu-pane {
    position: fixed;
    top: 0;
    left: -300px;
    width: 240px;
    height: 100vh;
    background: linear-gradient(180deg, #3d3d3d 0%, #2a2a2a 100%);
    z-index: 1040;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar-menu-pane.open {
    left: 0;
}

/* Menu Header */
.sidebar-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    color: white;
}

.sidebar-menu-title {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-menu-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sidebar-menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Navigation Links */
.sidebar-menu-nav {
    padding: 15px 0;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: #e67e22;
}

.sidebar-menu-link.highlight {
    color: #ffc107;
    font-weight: 600;
}

.sidebar-menu-link.highlight-alt {
    color: #17a2b8;
    font-weight: 600;
}

.sidebar-menu-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

/* Divider */
.sidebar-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 20px;
}

/* Overlay */
.sidebar-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Old menu styles (for backward compatibility) */
.admin-menu-container {
    position: relative;
}

.admin-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.side-pane-menu {
    position: fixed;
    top: 0;
    left: -240px;
    width: 240px;
    height: 100vh;
    background: linear-gradient(180deg, #3d3d3d 0%, #2a2a2a 100%);
    z-index: 1040;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding-top: 60px;
}

.side-pane-menu a {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.side-pane-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.side-pane-menu .closebtn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 30px;
    color: white;
}

/* ============================================
   Persistent Sidebar Layout Styles
   ============================================ */

/* Main Layout Container */
.page-layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* Sidebar */
.page-sidebar {
    width: 250px;
    background: linear-gradient(180deg, #3d3d3d 0%, #2a2a2a 100%);
    color: white;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    transition: width 0.3s ease;
}

.page-sidebar.collapsed {
    width: 60px;
}

.page-sidebar.collapsed .sidebar-header-content {
    display: none;
}

.page-sidebar.collapsed .sidebar-nav-link span {
    display: none;
}

.page-sidebar.collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 0.6rem 0.5rem;
}

.page-sidebar.collapsed .sidebar-nav-link i {
    margin-right: 0;
}

/* Sidebar Header */
.sidebar-header {
    padding: 0.75rem 1rem 0.75rem 0.5rem;
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header-content {
    flex: 1;
}

.sidebar-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0;
    white-space: nowrap;
}

.sidebar-name {
    font-size: 0.85rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, 0.9);
}

/* Toggle Button */
.sidebar-toggle {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.page-sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Sidebar Navigation */
.page-sidebar .sidebar-nav {
    padding: 0.75rem 0;
}

.page-sidebar .sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: 6px;
    margin: 2px 0.5rem;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-sidebar .sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.page-sidebar .sidebar-nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.page-sidebar .sidebar-nav-link i {
    width: 22px;
    margin-right: 10px;
    text-align: center;
}

/* Sidebar Divider */
.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0.75rem 1rem;
}

/* Sidebar Section Label */
.sidebar-section-label {
    padding: 0.3rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 0.15rem;
}

.page-sidebar.collapsed .sidebar-section-label {
    display: none;
}


/* Main Content Area */
.page-main-content {
    flex-grow: 1;
    background: #f8f9fa;
    overflow-x: hidden;
    position: relative;
    z-index: 1;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .page-layout {
        flex-direction: column;
    }

    .page-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        transition: all 0.3s ease;
        z-index: 1040;
        /* Ensure it stacks above content */
        overflow: visible;
        /* Allow absolute menu to show outside */
    }

    /* When collapsed on mobile, only show header */
    .page-sidebar.collapsed {
        width: 100%;
    }

    .page-sidebar.collapsed .sidebar-nav {
        /* display: none; Removed to allow max-height transition */
        overflow: hidden;
        /* Ensure content is hidden when height is 0 */
    }

    .page-sidebar.collapsed .sidebar-header {
        border-bottom: none;
    }

    .sidebar-header {
        cursor: pointer;
        /* Make header clickable to toggle */
    }

    .sidebar-toggle {
        display: flex;
        transform: rotate(90deg);
        /* Point up when open (chevron-left rotated 90deg is up) */
        transition: transform 0.3s ease;
    }

    .page-sidebar.collapsed .sidebar-toggle {
        transform: rotate(-90deg);
        /* Point down when collapsed (chevron-left rotated -90deg is down) */
    }

    .page-sidebar.collapsed .sidebar-toggle i {
        transform: none;
    }

    /* Ensure content is full width */
    .page-main-content {
        width: 100%;
    }

    /* Mobile sidebar smooth slide down - Absolute Overlay */
    .page-sidebar .sidebar-nav {
        max-height: 1000px;
        overflow-y: auto;
        overflow-x: hidden;
        transition: max-height 0.4s ease-in-out, padding 0.4s ease, opacity 0.4s ease;
        position: absolute;
        width: 100%;
        background: linear-gradient(180deg, #3d3d3d 0%, #2a2a2a 100%);
        /* Same as sidebar bg */
        z-index: 1050;
        left: 0;
        top: 100%;
        /* Position right below the header */
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
        border-radius: 0 0 10px 10px;
    }

    .page-sidebar.collapsed .sidebar-nav {
        max-height: 0;
        padding: 0;
        opacity: 0;
        box-shadow: none;
    }

    /* Mobile compact close arrow - centered at end of menu */
    .sidebar-close-line {
        display: flex;
        justify-content: center;
        padding: 6px 0;
        cursor: pointer;
    }

    .sidebar-close-line .close-line {
        display: none;
    }

    .sidebar-close-line i {
        color: rgba(255, 255, 255, 0.5);
        font-size: 14px;
        transition: color 0.3s ease;
    }

    .sidebar-close-line:hover i {
        color: white;
    }

    .sidebar-footer-toggle {
        display: none;
    }
}

/* Hide mobile toggle on desktop */
@media (min-width: 993px) {
    .sidebar-footer-toggle {
        display: none;
    }
}

/* ============================================
   Enhanced Mobile Styles for Skater Pages
   ============================================ */
@media (max-width: 768px) {

    /* Improved touch targets for navigation links */
    .sidebar-menu-link {
        padding: 14px 20px;
        min-height: 50px;
        font-size: 15px;
        display: flex;
        align-items: center;
    }

    .sidebar-menu-link i {
        font-size: 18px;
        width: 24px;
    }

    /* Ensure sidebar menu pane has proper z-index */
    .sidebar-menu-pane {
        z-index: 1050;
        width: 75vw;
        max-width: 300px;
    }

    /* Overlay should cover everything */
    .sidebar-menu-overlay {
        z-index: 1045;
    }

    /* Toggle button touch-friendly size */
    .sidebar-menu-toggle {
        min-width: 48px;
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
    }

    /* Close button larger touch target */
    .sidebar-menu-close {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }

    /* Page sidebar mobile improvements */
    .page-sidebar .sidebar-nav-link {
        padding: 12px 16px;
        min-height: 48px;
        font-size: 0.95rem;
    }

    .page-sidebar .sidebar-nav-link i {
        font-size: 1.1rem;
        width: 26px;
    }

    /* Better header tap area */
    .sidebar-header {
        min-height: 50px;
        padding: 0.75rem 3rem 0.75rem 1rem !important;
    }

    .sidebar-toggle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* iPhone Safe Area Support */
@supports (padding: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        .sidebar-menu-pane {
            padding-top: env(safe-area-inset-top);
            padding-bottom: env(safe-area-inset-bottom);
        }

        .sidebar-menu-header {
            padding-top: calc(20px + env(safe-area-inset-top));
        }

        .page-sidebar {
            padding-top: env(safe-area-inset-top);
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}