@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

/* --- GLOBAL LAYOUT --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    overflow-x: hidden;
}

/* --- LUXURY HEADER --- */
.luxury-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background-color: #ec1f27;
    border-bottom: 1px solid #eee; 
    z-index: 1001; /* Higher than sidebar to stay on top */
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.nav-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
}

.header-left {
    display: flex;
    align-items: center;
}

/* Fix for the giant logo */
.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

/* Hamburger Icon */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 14px;
    cursor: pointer;
    margin-right: 25px;
}

.menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #ffffff;
    border-radius: 2px;
    transition: 0.3s;
}

/* Search Bar */
.search-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 40px;
}

.search-wrapper form {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 5px 15px;
    width: 100%;
    max-width: 400px;
}

.search-input {
    border: none;
    background: transparent;
    padding: 8px;
    width: 100%;
    font-size: 13px;
    outline: none;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
}

/* Top Nav Links */
.nav-links a {
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    color: #ffffff; 
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: 0.3s;
    margin-left: 30px;
}

.nav-links a.active, .nav-links a:hover {
    color: #ec1f27;
}

/* --- SLIM SIDEBAR --- */
.sidebar {
    position: fixed; /* Fixes it to the screen */
    top: 80px;      /* Match header height */
    left: 0;
    width: 250px;   /* Expanded width */
    height: calc(100vh - 80px); /* Fill remaining screen height */
    background: #fff;
    border-right: 1px solid #eee;
    z-index: 1000;
    display: flex;
    flex-direction: column; /* Required for the bottom profile dock */
    transition: width 0.3s ease;
    overflow: hidden; /* Prevents sidebar itself from scrolling */
}

/* Collapsed State: Icons Only */
.sidebar.collapsed {
    width: 70px; /* Matches mainpage.css margin */
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding-top: 10px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: #334155; /* Better dark gray color */
    white-space: nowrap;
    width: 100%; /* Force full width */
    transition: 0.2s;
    border-left: 4px solid transparent; /* Prepare for active state */
}

.sidebar.collapsed .link-text,
.sidebar.collapsed .profile-info,
.sidebar.collapsed .user-details-box {
    display: none !important; /* Hide text in slim mode */
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center !important;
    padding: 15px !important;
}

.sidebar.collapsed .profile-link {
    justify-content: center !important;
    padding: 15px !important;
}

.sidebar.collapsed .profile-pfp-container {
    margin: 0 !important; /* Center the profile avatar */
}

.sidebar .icon {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.sidebar .link-text {
    margin-left: 15px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Active State */
.sidebar-nav a.active {
    color: #ec1f27;
    background: #fff5f5;
    border-left: 4px solid #ec1f27; /* Better left border for active state */
}

.sidebar-nav a:hover {
    background: #f8fafc;
    color: #ec1f27;
}

/* --- MAIN CONTENT WRAPPER --- */
.main-wrapper {
    margin-left: 70px; /* Matches collapsed sidebar width */
    padding-top: 100px; /* Accounts for header height */
    background-color: #f8fafc;
    min-height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease;
    width: calc(100% - 70px);
}

/* When sidebar is expanded */
.main-wrapper.shifted {
    margin-left: 250px; /* Matches expanded sidebar width */
    width: calc(100% - 250px);
}

/* --- RESPONSIVE FIX --- */
@media (max-width: 768px) {
    .search-wrapper { display: none; }
    .main-wrapper { margin-left: 0; width: 100%; padding-top: 80px; }
    .main-wrapper.shifted { margin-left: 0; width: 100%; } /* Don't expand on mobile */
}

/* --- SIDEBAR ICON STYLING --- */
.sidebar .icon {
    font-size: 18px;
    min-width: 24px;
    display: inline-block;
    text-align: center;
    transition: filter 0.3s ease, transform 0.2s ease;
    
    /* DEFAULT STATE: Make emoji icons solid black */
    filter: grayscale(100%) brightness(0%); 
}

/* ACTIVE STATE: Make icon red when the link is active */
/* The filter below converts black to approx. #ec1f27 Brand Red */
.sidebar-nav a.active .icon {
    filter: invert(21%) sepia(100%) saturate(7414%) hue-rotate(354deg) brightness(92%) contrast(89%);
}

/* Optional: Turn red on hover too */
.sidebar-nav a:hover .icon {
    filter: invert(21%) sepia(100%) saturate(7414%) hue-rotate(354deg) brightness(92%) contrast(89%);
    transform: scale(1.1);
}

/* --- HEADER SEARCH ICON --- */
.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    filter: grayscale(100%) brightness(0%); /* Black by default */
    transition: filter 0.3s ease;
}

.search-btn:hover {
    filter: invert(21%) sepia(100%) saturate(7414%) hue-rotate(354deg) brightness(92%) contrast(89%);
}

/* --- LOGO SIZE FIX --- */
.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

@media screen and (max-width: 480px) {
    /* Hide the sidebar completely on mobile to give space to content */
    #sideMenu {
        display: none;
    }

    /* Remove the left margin so the welcome banner and categories touch the edges */
    .main-wrapper {
        margin-left: 0 !important;
        padding: 10px;
        width: 100%;
    }

    /* Center the brand logo in the header */
    .nav-container {
        justify-content: center;
    }
    
    .header-left .menu-toggle {
        display: block; /* Use this to trigger a mobile-only drawer later */
    }
}

/* Sidebar Core Layout */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    height: 100%; /* Spans the full 100vh sidebar */
}

.nav-bottom {
    margin-top: auto; /* Pushes profile to the bottom edge */
    padding-bottom: 20px;
    border-top: 1px solid #eee;
}

.nav-main-links {
    flex-grow: 0;
}

/* Push this div to the very bottom */
.nav-profile-bottom {
    margin-top: auto; 
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 10px;
    margin-bottom: 20px;
}

/* Profile Icon Styling */
.profile-icon-frame {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #eee;
    transition: 0.3s;
    flex-shrink: 0;
}

.sidebar-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* User Info Box Logic */
.user-details-box {
    display: none; /* Hidden when sidebar is collapsed */
    flex-direction: column;
    margin-left: 12px;
    overflow: hidden;
}

/* Show info when sidebar expands */
.sidebar:not(.collapsed) .user-details-box {
    display: flex;
}

.user-name-text {
    font-size: 11px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

.user-email-text {
    font-size: 9px;
    color: #999;
    white-space: nowrap;
}

/* Active Highlight for Profile */
.profile-item.active .profile-icon-frame {
    border-color: #ec1f27; /* Your Brand Red */
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: #ec1f27; /* Brand Red */
    border: 1.5px solid white;
    border-radius: 50%;
}

/* Optional: Pulse animation for a high-end feel */
@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(236, 31, 39, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(236, 31, 39, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(236, 31, 39, 0); }
}

.notification-badge {
    animation: pulse-red 2s infinite;
}

@media screen and (max-width: 480px) {
    .sidebar {
        width: 0; /* Hide by default on mobile */
        display: none;
    }
    
    .main-wrapper {
        margin-left: 0 !important; /* Content takes full width */
    }
}

/* --- FIXED LENGTH SIDEBAR REMOVED --- */
/* (Duplicate sidebar code merged above) */

/* --- FLEXBOX NAVIGATION --- */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    height: 100%; /* Spans the full sidebar height */
    padding: 10px 0;
}

/* Group for top links */
.nav-top {
    flex-grow: 0;
}

/* Group for the bottom profile */
.nav-bottom {
    margin-top: auto; /* Magnetically pushes to the bottom edge */
    border-top: 1px solid rgba(0,0,0,0.05);
    padding: 10px 0;
    background-color: #fff;
}

/* Standardize the look of the Profile Link */
.profile-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: #000;
    transition: 0.2s;
    height: 54px; /* Matches height of other sidebar links */
}

/* Ensure the image container is consistent */
.profile-pfp-container {
    min-width: 24px; /* Matches icon width of other links */
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-pfp {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000; /* High value to stay above inbox cards */
}

/* Main wrapper padding moved to top definition */

/* Luxury Card Shadow used across the platform */
.luxury-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

/* Mobile View Styling */
@media (max-width: 768px) {
    #sideMenu {
        position: fixed;
        left: -250px; /* Hide off-screen */
        top: 0;
        height: 100%;
        width: 250px;
        z-index: 5000; /* Ensure it's above everything */
        background: #fff;
        transition: 0.3s ease;
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    }

    /* When the .active class is added via JS, slide it in */
    #sideMenu.active {
        left: 0;
    }

    /* Content should NOT shift on mobile, it stays full width */
    #contentWrapper.shifted {
        margin-left: 0; 
    }
}

/* Sidebar Overlay: Dims the background when menu is open on iPhone */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 4999; /* Just below sideMenu (5000) */
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

@media (max-width: 768px) {
    /* Ensure the hamburger icon is visible and easy to tap */
    .menu-toggle {
        padding: 10px; /* Larger hit area for fingers */
        display: flex !important;
    }
    
    /* Ensure sidebar starts below or over the header depending on preference */
    #sideMenu {
        top: 0; /* Full height on mobile */
        height: 100vh;
    }
}

/* --- MOBILE SIDEBAR & OVERLAY STYLES --- */

/* 1. Sidebar Overlay (The dark background) */
.sidebar-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001; /* Behind sidebar, above everything else */
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show overlay when active */
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* 2. Media Query for Mobile/Tablets */
@media (max-width: 768px) {
    
    /* Force Sidebar to be Fixed and Off-Screen */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px; /* Hide completely off-screen */
        width: 260px !important; /* Fixed width for mobile */
        height: 100vh;
        z-index: 1002; /* Topmost layer */
        background: #fff;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        
        /* Reset any 'collapsed' desktop styles */
        width: 260px; 
    }

    /* When 'active' class is added by JS, slide it in */
    .sidebar.active {
        left: 0;
    }

    /* Adjust content wrapper so it doesn't break */
    #contentWrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Ensure hamburger menu is visible */
    .menu-toggle {
        display: block;
        cursor: pointer;
        font-size: 24px;
        color: #333;
    }
}

/* --- MOBILE & TABLET STYLES (Max Width: 768px) --- */
@media (max-width: 768px) {
    
    /* 1. Reset the Sidebar for Mobile */
    .sidebar {
        position: fixed;        /* Float on top of everything */
        top: 0;
        left: -280px;          /* HIDE IT: Push it off the left edge */
        width: 260px !important; /* Force full width (override 'collapsed' width) */
        height: 100vh;         /* Full height */
        z-index: 10000;        /* Sit on top of all content */
        background-color: #fff;
        transition: left 0.3s ease; /* Smooth slide animation */
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        display: block !important; /* Ensure it's not hidden by display:none */
    }

    /* 2. The 'Active' Class (Triggered by your JS) */
    .sidebar.active {
        left: 0; /* SLIDE IN: Bring it back to the edge */
    }

    /* 3. Make sure the Hamburger Button is Visible */
    .menu-toggle {
        display: block !important;
        cursor: pointer;
        font-size: 24px;
        color: #333;
        margin-right: 15px;
    }

    /* 4. Fix the Main Content so it doesn't break */
    #contentWrapper, .main-content {
        margin-left: 0 !important; /* Remove the empty space on the left */
        width: 100% !important;
        padding-top: 80px; /* Prevent header overlap */
    }

    /* 5. Overlay (Dark background when menu is open) */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 9999;
    }
    .sidebar-overlay.active {
        display: block;
    }
}

/* --- LUXURY FOOTER STYLES --- */
.luxury-footer {
    background-color: #8a1217; /* Dark Burgundy */
    color: #ffdce0; /* Soft text */
    padding: 60px 0 20px;
    font-size: 14px;
    margin-top: auto; /* Pushes footer to bottom if page is short */
    position: relative;
    z-index: 1002; /* Higher than sidebar */
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    padding: 0 20px;
}

.footer-section h3 {
    color: #ffffff;
    font-size: 16px;
    margin-bottom: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.footer-section p {
    line-height: 1.6;
    margin-bottom: 15px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: #ffdce0;
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-block;
}

.footer-section ul li a:hover {
    color: #ffffff;
    text-decoration: underline;
    transform: translateX(5px);
}

/* Social Icons */
.social-links {
    display: flex;
    gap: 15px;
}
.social-links a {
    color: #fff;
    background: #333;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    transition: 0.3s;
}
.social-links a:hover {
    background: #ec1f27;
}

/* Bottom Bar */
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 50px;
    padding-top: 20px;
    text-align: center;
    font-size: 13px;
    color: #ffdce0;
}

.footer-bottom p {
    margin: 0;
    opacity: 0.7;
}