
/**
 * Sidebar Overlay Styles
 * Beautiful right-side sliding overlay sidebar with light/dark mode support
 */

/* ===================================
   RESET AND BASE STYLES
   =================================== */
.sidebar-base * {
    box-sizing: border-box;
}

/* ===================================
   MAIN SIDEBAR CONTAINER
   =================================== */
.sidebar-base {
    /* Default Positioning (Fixed Mode) */
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    
    /* Default Z-Index (Overlap Header) */
    z-index: 9999;
    
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Mode Modifiers */
.sidebar-base.sidebar-mode-fixed {
    position: fixed;
    height: 100vh;
}

.sidebar-base.sidebar-mode-overlay {
    position: absolute;
    height: 100%;
}

/* Header Overlap Modifier */
.sidebar-base:not(.sidebar-overlap-header) {
    z-index: 990; /* Lower z-index to sit behind typical sticky headers */
}

/* Active State */
.sidebar-base.sidebar-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Background Blocking Modifier */
.sidebar-base:not(.sidebar-block-background) .sidebar-base-bg {
    display: none;
}

.sidebar-base.sidebar-active:not(.sidebar-block-background) {
    pointer-events: none; /* Allow clicks through wrapper */
}

.sidebar-base.sidebar-active:not(.sidebar-block-background) .sidebar-panel {
    pointer-events: auto; /* Catch clicks on panel */
}

/* ===================================
   OVERLAY BACKGROUND
   =================================== */
.sidebar-base-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
    opacity: 0;
}

.sidebar-base.sidebar-active .sidebar-base-bg {
    opacity: 1;
}

/* ===================================
   SIDEBAR PANEL
   =================================== */
.sidebar-panel {
    position: absolute;
    background: #ffffff;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    
    /* Defaults for 'right' position (fallback) */
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    height: 100%;
    transform: translateX(100%);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
}

/* Position: Right (Default/Explicit) */
.sidebar-base.sidebar-position-right .sidebar-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    /*width: 480px;*/
    height: 100%;
    transform: translateX(100%);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
}

/* Position: Left */
.sidebar-base.sidebar-position-left .sidebar-panel {
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    /*width: 480px;*/
    height: 100%;
    transform: translateX(-100%);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.15);
}

/* Position: Top */
.sidebar-base.sidebar-position-top .sidebar-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: auto;
    max-height: 80%;
    transform: translateY(-100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* Position: Bottom */
.sidebar-base.sidebar-position-bottom .sidebar-panel {
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: auto;
    max-height: 80%;
    transform: translateY(100%);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}

/* Active Transform Reset */
.sidebar-base.sidebar-active .sidebar-panel {
    transform: translate(0, 0);
}

/* ===================================
   HEADER SECTION
   =================================== */
.sidebar-header {
    padding: 24px 28px;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    flex-shrink: 0;
}

.sidebar-title {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    color: #202124;
    line-height: 1.3;
}

/* Close Button */
.sidebar-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.sidebar-close:hover {
    background-color: #f1f3f4;
}

.sidebar-close:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.close-icon {
    position: relative;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.close-line {
    position: absolute;
    width: 16px;
    height: 2px;
    background: #5f6368;
    border-radius: 1px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    transition: background-color 0.2s ease;
    pointer-events: none;
}

.close-line:nth-child(2) {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.sidebar-close:hover .close-line {
    background: #202124;
}

/* ===================================
   CONTENT AREA
   =================================== */
.sidebar-content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Custom Scrollbar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* Content Sections */
.sidebar-section {
    margin-bottom: 32px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h4 {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 600;
    color: #202124;
}

.sidebar-section h5 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #202124;
}

.sidebar-section p {
    margin: 0 0 16px 0;
    color: #5f6368;
    line-height: 1.6;
}

/* ===================================
   LISTS AND LINKS
   =================================== */
.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-list li {
    margin-bottom: 8px;
}

.sidebar-link {
    display: block;
    padding: 12px 16px;
    color: #5f6368;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background-color: #f8f9fa;
    color: #1a73e8;
    border-color: #e8f0fe;
}

/* ===================================
   ACTIVITY ITEMS
   =================================== */
.activity-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f4;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

.activity-text p {
    margin: 0 0 4px 0;
    color: #202124;
    font-weight: 500;
}

.activity-text small {
    color: #5f6368;
    font-size: 12px;
}

/* ===================================
   FOOTER SECTION
   =================================== */
.sidebar-footer {
    padding: 24px 28px;
    border-top: 1px solid #e8eaed;
    background: #f8f9fa;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    justify-content: flex-end;
}

.sidebar-action-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    flex: 1;
}

/* Filled button */
.sidebar-action-btn.primary {
    background: #1a73e8;
    border: none;
    color: white;
}
.sidebar-action-btn.primary:hover {
    background: #1557b0;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

/* Ghost button */
.sidebar-action-btn.secondary {
    background: transparent;
    border: 1px solid #dadce0;
    color: #5f6368;
}
.sidebar-action-btn.secondary:hover {
    background: #f8f9fa;
    color: #202124;
}

/* ===================================
   TRIGGER BUTTON
   =================================== */
.sidebar-trigger {
    position: fixed;
    top: 50%;
    right: 24px;
    transform: translateY(-50%);
    background: #1a73e8;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26, 115, 232, 0.3);
    transition: all 0.3s ease;
    z-index: 888;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-trigger:hover {
    background: #1557b0;
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.4);
    transform: translateY(-50%) scale(1.05);
}

.trigger-icon {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.trigger-line {
    width: 18px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.sidebar-trigger:hover .trigger-line:nth-child(1) {
    transform: translateX(-2px);
}

.sidebar-trigger:hover .trigger-line:nth-child(3) {
    transform: translateX(2px);
}

/* ===================================
   BODY SCROLL PREVENTION
   =================================== */
body.sidebar-base-open {
    overflow: hidden;
    height: 100vh;
    touch-action: none;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
    .sidebar-panel {
        width: 100%;
        max-width: 400px;
    }

    .sidebar-header,
    .sidebar-content,
    .sidebar-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .sidebar-trigger {
        right: 16px;
        width: 48px;
        height: 48px;
    }

    .trigger-line {
        width: 16px;
    }
}

@media (max-width: 480px) {
    .sidebar-panel {
        width: 100vw;
    }

    .sidebar-footer {
        flex-direction: column;
    }
}

/* ===================================
   ANIMATION ENHANCEMENTS
   =================================== */
@media (prefers-reduced-motion: no-preference) {
    .sidebar-base {
        transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    }

    .sidebar-panel {
        transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    }
}

/* ===================================
   LIGHT MODE (DEFAULT) - EXPLICIT
   =================================== */
@media (prefers-color-scheme: light) {
    .sidebar-panel {
        background: #ffffff;
        color: #202124;
    }

    .sidebar-header,
    .sidebar-footer {
        background: #f8f9fa;
        border-color: #e8eaed;
    }

    .sidebar-title,
    .sidebar-section h4,
    .sidebar-section h5,
    .activity-text p {
        color: #202124;
    }

    .sidebar-section p,
    .sidebar-link,
    .activity-text small {
        color: #5f6368;
    }

    .sidebar-link:hover {
        background-color: #f8f9fa;
        color: #1a73e8;
        border-color: #e8f0fe;
    }

    .sidebar-close:hover {
        background-color: #f1f3f4;
    }

    .close-line {
        background: #5f6368;
    }

    .sidebar-close:hover .close-line {
        background: #202124;
    }

    .sidebar-action-btn.secondary {
        color: #5f6368;
        border-color: #dadce0;
    }

    .sidebar-action-btn.secondary:hover {
        background: #f8f9fa;
        color: #202124;
    }

    .activity-item {
        border-color: #f1f3f4;
    }

    .sidebar-content::-webkit-scrollbar-thumb {
        background: #dadce0;
    }

    .sidebar-content::-webkit-scrollbar-thumb:hover {
        background: #bdc1c6;
    }
}

/* ===================================
   DARK MODE SUPPORT
   =================================== */
@media (prefers-color-scheme: dark) {
    .sidebar-base-bg {
        background: rgba(0, 0, 0, 0.7);
    }

    .sidebar-panel {
        background: #1f1f1f;
        color: #ffffff;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
    }

    .sidebar-header,
    .sidebar-footer {
        background: #2d2d2d;
        border-color: #404040;
    }

    .sidebar-title,
    .sidebar-section h4,
    .sidebar-section h5,
    .activity-text p {
        color: #ffffff;
    }

    .sidebar-section p,
    .sidebar-link,
    .activity-text small {
        color: #b3b3b3;
    }

    .sidebar-link:hover {
        background-color: #333333;
        color: #64b5f6;
        border-color: #404040;
    }

    .activity-item {
        border-color: #404040;
    }

    .close-line {
        background: #b3b3b3;
    }

    .sidebar-close:hover {
        background-color: #333333;
    }

    .sidebar-close:hover .close-line {
        background: #ffffff;
    }

    .sidebar-action-btn.secondary {
        color: #b3b3b3;
        border-color: #404040;
    }

    .sidebar-action-btn.secondary:hover {
        background: #333333;
        color: #ffffff;
    }

    .sidebar-content::-webkit-scrollbar-thumb {
        background: #555555;
    }

    .sidebar-content::-webkit-scrollbar-thumb:hover {
        background: #666666;
    }
}

/* ===================================*/
/*   MANUAL MODE CLASSES (OPTIONAL)*/
/*   =================================== */
/* Force Light Mode */
/*.sidebar-base.light-mode {*/
/*    color-scheme: light;*/
/*}*/

/*.sidebar-base.light-mode .sidebar-panel {*/
/*    background: #ffffff;*/
/*    color: #202124;*/
/*}*/

/*.sidebar-base.light-mode .sidebar-header,*/
/*.sidebar-base.light-mode .sidebar-footer {*/
/*    background: #f8f9fa;*/
/*    border-color: #e8eaed;*/
/*}*/

/*!* Force Dark Mode *!*/
/*.sidebar-base.dark-mode {*/
/*    color-scheme: dark;*/
/*}*/

/*.sidebar-base.dark-mode .sidebar-panel {*/
/*    background: #1f1f1f;*/
/*    color: #ffffff;*/
/*}*/

/*.sidebar-base.dark-mode .sidebar-header,*/
/*.sidebar-base.dark-mode .sidebar-footer {*/
/*    background: #2d2d2d;*/
/*    border-color: #404040;*/
/*}*/

/*.sidebar-base.dark-mode .sidebar-title,*/
/*.sidebar-base.dark-mode .sidebar-section h4,*/
/*.sidebar-base.dark-mode .sidebar-section h5 {*/
/*    color: #ffffff;*/
/*}*/

/*.sidebar-base.dark-mode .sidebar-section p,*/
/*.sidebar-base.dark-mode .sidebar-link {*/
/*    color: #b3b3b3;*/
/*}*/