/* 
 * Modern Sidebar CSS for Yaya Foundation
 * Author: AI Assistant
 * Version: 2.0
 */

:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --sidebar-bg: linear-gradient(135deg, #cf864b 0%, #b5703d 100%);
    --sidebar-text: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: rgba(255, 255, 255, 0.2);
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --transition-speed: 0.3s;
    --primary-color: #cf864b;
    --accent-color: #f59e0b;
}

/* Sidebar Container */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    transition: transform var(--transition-speed) ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

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

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

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.1);
    position: relative;
    top: auto;
    z-index: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--sidebar-text);
    transition: transform 0.3s ease;
    flex-wrap: nowrap;
    width: 100%;
}

.sidebar-logo:hover {
    transform: scale(1.05);
    color: var(--sidebar-text);
}

.sidebar-logo img,
.sidebar-logo-img {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.sidebar-logo:hover img,
.sidebar-logo:hover .sidebar-logo-img {
    border-color: var(--accent-color);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

.sidebar-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

.sidebar-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: none;
}

.sidebar-toggle:hover {
    background: var(--sidebar-hover);
    transform: rotate(90deg);
}

/* Sidebar Search */
.sidebar-search {
    padding: 1.25rem;
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.05);
}

.sidebar-search .search-form {
    margin: 0;
}

.sidebar-search .input-group {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.sidebar-search .form-control {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.sidebar-search .form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-search .form-control:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
    color: var(--sidebar-text);
    box-shadow: 0 0 0 0.2rem rgba(207, 134, 75, 0.25);
}

.sidebar-search .btn {
    background: var(--accent-color);
    border: none;
    color: #fff;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.sidebar-search .btn:hover {
    background: #b5703d;
    transform: scale(1.05);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow: visible;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 0.2rem 0.65rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1rem;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    transition: transform 0.3s ease, color 0.3s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: #fff;
    border-color: rgba(207, 134, 75, 0.35);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transform: translateX(-3px);
}

.nav-link:hover::before,
.nav-link.active::before {
    opacity: 1;
}

.nav-link:hover i,
.nav-link.active i {
    transform: scale(1.1);
    color: var(--accent-color);
}

.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
}

/* Dropdown Menu */
.nav-item-dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-icon {
    margin-right: auto;
    transition: transform 0.3s ease;
    font-size: 0.85rem;
}

.nav-item-dropdown.active .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0.5rem 0 0 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    display: block;
    position: static;
    box-shadow: none;
}

.nav-item-dropdown.active .dropdown-menu {
    max-height: 300px;
    padding: 0.5rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem 0.75rem 3rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    margin: 0.25rem 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    transform: translateX(-3px);
}

.dropdown-item:hover i {
    color: var(--accent-color);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.1);
    text-align: center;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.social-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.social-link:hover {
    background: var(--accent-color);
    color: #fff;
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 5px 15px rgba(207, 134, 75, 0.4);
}

.copyright {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Toggle Button (Mobile) */
.sidebar-toggle-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 998;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.sidebar-toggle-btn:hover {
    background: var(--accent-color);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(207, 134, 75, 0.4);
}

.sidebar-toggle-btn.active {
    right: calc(var(--sidebar-width) + 1rem);
}

/* Main Content */
.main-content {
    width: 100%;
    margin: 0;
    padding-right: var(--sidebar-width);
    min-height: 100vh;
    transition: padding-right var(--transition-speed) ease;
    background: #f8f9fa;
    position: relative;
    box-sizing: border-box;
}

/* Footer Styling with Sidebar */
footer {
    width: 100%;
    margin: 0;
    padding-right: var(--sidebar-width);
    transition: padding-right var(--transition-speed) ease;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

/* Ensure sections take full width of main-content */
.main-content > section {
    width: 100%;
    position: relative;
    z-index: 1;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

.main-content > .container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* Responsive Design */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
        width: 100%;
        right: 0;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    footer {
        margin-right: 0;
        width: 100%;
        right: 0;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-toggle-btn {
        display: flex;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Reset section widths on mobile */
    .main-content section {
        width: 100%;
        margin: 0;
    }

    .main-content > .container {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 75%;
    }

    .sidebar-title {
        font-size: 1rem;
    }

    .nav-link {
        padding: 1rem;
        font-size: 1rem;
    }

    .sidebar-search {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .sidebar-header {
        padding: 1rem;
    }

    .sidebar-logo img {
        width: 40px;
        height: 40px;
    }

    .sidebar-title {
        font-size: 0.9rem;
    }

    .nav-link {
        padding: 0.875rem;
        font-size: 0.95rem;
    }

    .sidebar-footer {
        padding: 1rem;
    }

    .social-link {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* Animation for sidebar items */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-item {
    animation: slideInRight 0.3s ease backwards;
}

.nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-item:nth-child(2) { animation-delay: 0.1s; }
.nav-item:nth-child(3) { animation-delay: 0.15s; }
.nav-item:nth-child(4) { animation-delay: 0.2s; }
.nav-item:nth-child(5) { animation-delay: 0.25s; }
.nav-item:nth-child(6) { animation-delay: 0.3s; }
.nav-item:nth-child(7) { animation-delay: 0.35s; }
.nav-item:nth-child(8) { animation-delay: 0.4s; }
.nav-item:nth-child(9) { animation-delay: 0.45s; }
.nav-item:nth-child(10) { animation-delay: 0.5s; }

/* Additional fixes for content overlap - Desktop only */
@media (min-width: 993px) {
    /* All sections take full width of main-content */
    .main-content section[class*="section-padding"],
    .main-content section[class*="heritage-hero"],
    .main-content section[class*="bg-"],
    .main-content section[style*="background"] {
        width: 100%;
        margin: 0;
        padding-left: 0;
        padding-right: 0;
        box-sizing: border-box;
    }

    /* Containers inside sections */
    .main-content section .container {
        width: 100%;
        max-width: 1400px;
        margin: 0 auto;
        padding-left: 2rem;
        padding-right: 2rem;
        box-sizing: border-box;
        position: relative;
        z-index: 2;
    }

    /* Full-width sections with backgrounds */
    .main-content section[style*="background"] .container,
    .main-content section[class*="bg-"] .container {
        width: 100%;
        max-width: 1400px;
        margin: 0 auto;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .sidebar-overlay,
    .sidebar-toggle-btn {
        display: none !important;
    }

    .main-content {
        margin-right: 0 !important;
    }

    footer {
        margin-right: 0 !important;
    }
}

