/* Fixed Right Sidebar */
.fixed-sidebar {
    position: fixed;
    right: 0px;
    top: 50%;
    width: 320px;
    z-index: 999;
    padding: 0;
    overflow: visible;
    transition: transform 0.3s ease;
    transform: translateX(calc(120%));
}

.sidebar-inner {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
}

/* Collapse / Expand Tab */
.collapse-btn {
    position: absolute;
    left: -36px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 72px;
    background: white;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    border-right: none;
    border-radius: 10px 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
    padding: 0;
    z-index: 1;
}

.collapse-btn:hover {
    background: #f5f5f5;
}

/* Chevron arrow — points right when expanded (click to collapse) */
.collapse-btn::after {
    content: "";
    width: 9px;
    height: 9px;
    border-right: 2.5px solid #FF8000;
    border-bottom: 2.5px solid #FF8000;
    transform: rotate(-45deg);
    margin-right: 4px;
}

/* Chevron flips left when collapsed (click to expand) */
.fixed-sidebar.collapsed .collapse-btn::after {
    transform: rotate(135deg);
    margin-right: 0;
    margin-left: 4px;
}

/* Custom Scrollbar for Sidebar */
.sidebar-inner::-webkit-scrollbar {
    width: 8px;
}

.sidebar-inner::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sidebar-inner::-webkit-scrollbar-thumb {
    background: #FF8000;
    border-radius: 10px;
}

.sidebar-inner::-webkit-scrollbar-thumb:hover {
    background: #e67300;
}

/* Visible state — sidebar slides in */
.fixed-sidebar.visible {
    transform: translateY(-42%);
}

/* Collapsed state — sidebar off-screen, only tab visible */
.fixed-sidebar.visible.collapsed {
    transform: translateY(-42%) translateX(calc(100%));
}

/* Sidebar Sections */
.sidebar-section {
    border-bottom: 2px solid #f0f0f0;
    padding: 20px;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #FF8000;
}

.sidebar-header h3 {
    color: #002F5E;
    font-size: 18px;
    margin: 0;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Sidebar News Items */
.sidebar-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #FF8000;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.sidebar-link {
    color: inherit;
    text-decoration: none;
    display: block;
    cursor: pointer;
}

.sidebar-item:hover {
    transform: translateX(-3px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.sidebar-date {
    color: #cc5500;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
}

.sidebar-item h4 {
    color: #002F5E;
    font-size: 14px;
    margin: 0 0 5px 0;
}

.sidebar-item p {
    color: #666;
    font-size: 13px;
    margin: 0;
    line-height: 1.4;
}

/* Sidebar Ads */
.sidebar-ad {
    border-radius: 8px;
    color: white;
    text-align: center;
}

.sidebar-ad .ad-image {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}

/* Responsive — Hide sidebar on tablets and mobile */
@media (max-width: 1399px) {
    .fixed-sidebar {
        display: none;
    }

    .container {
        max-width: 1200px;
        margin: 0 auto;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 85%;
    }
}

/* Adjust main container for sidebar on large screens (only when sidebar exists) */
@media (min-width: 1400px) {
    .has-sidebar .container {
        max-width: calc(100% - 380px);
        margin-right: 360px;
    }
}
