﻿/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Top Bar Styles */
.top-bar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

    .sidebar-toggle:hover {
        background-color: #f3f4f6;
    }

.company-logo {
    height: 40px;
    width: auto;
}

.top-bar-center {
    flex: 1;
    max-width: 600px;
    margin: 0 2rem;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

    .search-input:focus {
        outline: none;
        border-color: #0C8041;
    }

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dropdown Styles */
.dropdown-wrapper {
    position: relative;
}

.icon-button {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

    .icon-button:hover {
        background-color: #f3f4f6;
    }

    .icon-button .badge {
        position: absolute;
        top: 4px;
        right: 4px;
        background-color: #ef4444;
        color: white;
        font-size: 0.625rem;
        font-weight: 600;
        padding: 0.125rem 0.375rem;
        border-radius: 9999px;
        min-width: 18px;
        text-align: center;
    }

.account-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

    .account-button:hover {
        background-color: #f3f4f6;
    }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    min-width: 320px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    z-index: 1001;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

    .dropdown-header h6 {
        margin: 0;
        font-size: 0.875rem;
        font-weight: 600;
        color: #1f2937;
    }

    .dropdown-header .text-muted {
        font-size: 0.75rem;
        color: #6b7280;
    }

    .dropdown-header .btn-link {
        background: none;
        border: none;
        color: #0C8041;
        font-size: 0.75rem;
        cursor: pointer;
        text-decoration: none;
    }

        .dropdown-header .btn-link:hover {
            text-decoration: underline;
        }

.dropdown-body {
    overflow-y: auto;
    max-height: 300px;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    text-align: left;
}

    .dropdown-item:hover {
        background-color: #f9fafb;
    }

    .dropdown-item:last-child {
        border-bottom: none;
    }

    .dropdown-item.unread {
        background-color: #e8f5e9;
    }

    .dropdown-item svg {
        flex-shrink: 0;
        margin-right: 0.5rem;
    }

/* Messages Dropdown */
.message-item {
    align-items: flex-start;
}

    .message-item .avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
    }

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

    .message-header strong {
        font-size: 0.875rem;
        color: #1f2937;
    }

    .message-header .time {
        font-size: 0.75rem;
        color: #6b7280;
    }

.message-text {
    font-size: 0.813rem;
    color: #4b5563;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Notifications Dropdown */
.notification-item {
    align-items: flex-start;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .notification-icon.success {
        background-color: #d1fae5;
        color: #10b981;
    }

    .notification-icon.warning {
        background-color: #fef3c7;
        color: #f59e0b;
    }

    .notification-icon.info {
        background-color: #d4edda;
        color: #0C8041;
    }

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 0.813rem;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.notification-content .time {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Account Dropdown */
.account-dropdown {
    min-width: 260px;
}

.account-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.large-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

    .user-details strong {
        font-size: 0.875rem;
        color: #1f2937;
    }

    .user-details small {
        font-size: 0.75rem;
        color: #6b7280;
    }

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0;
}

.dropdown-item.logout {
    color: #ef4444;
}

    .dropdown-item.logout:hover {
        background-color: #fef2f2;
    }

.dropdown-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

    .dropdown-footer a {
        color: #0C8041;
        text-decoration: none;
        font-size: 0.813rem;
        font-weight: 500;
    }

        .dropdown-footer a:hover {
            text-decoration: underline;
        }

/* Sidenav Styles */
.sidenav {
    width: 260px;
    background: #1f2937;
    color: white;
    overflow-y: auto;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

    .sidenav.collapsed {
        width: 70px;
    }

.sidenav-nav {
    padding: 1rem 0;
}

.sidenav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: #d1d5db;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

    .sidenav .nav-item:hover {
        background-color: #374151;
        color: white;
    }

    .sidenav .nav-item.active {
        background-color: #0a5d2e;
        color: white;
        border-left-color: #0C8041;
    }

    .sidenav .nav-item svg {
        flex-shrink: 0;
    }

.sidenav.collapsed .nav-text {
    display: none;
}

.sidenav.collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.nav-divider {
    height: 1px;
    background-color: #374151;
    margin: 0.5rem 1rem;
}

.sidenav.collapsed .nav-divider {
    margin: 0.5rem 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    background-color: #f9fafb;
    transition: margin-left 0.3s ease;
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    .top-bar-center {
        display: none;
    }

    .user-name {
        display: none;
    }

    .sidenav {
        position: fixed;
        left: 0;
        top: 64px;
        height: calc(100vh - 64px);
        z-index: 999;
        transform: translateX(-100%);
    }

        .sidenav:not(.collapsed) {
            transform: translateX(0);
        }

        .sidenav.collapsed {
            transform: translateX(-100%);
            width: 260px;
        }

    .main-content {
        width: 100%;
    }
}

@media (min-width: 769px) {
    .sidenav {
        position: static;
        transform: none !important;
    }
}

/* Navigation Group & Sub-menu Styles */
.nav-group {
    position: relative;
}

.nav-item {
    position: relative;
    cursor: pointer;
}

    .nav-item .expand-icon {
        margin-left: auto;
        transition: transform 0.3s ease;
    }

        .nav-item .expand-icon.expanded {
            transform: rotate(180deg);
        }

.sidenav.collapsed .expand-icon {
    display: none;
}

/* Sub-menu Styles */
.sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.2);
}

    .sub-menu.open {
        max-height: 500px; /* Adjust based on your needs */
    }

.sub-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem 0.625rem 3rem;
    color: #d1d5db;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
    position: relative;
}

    .sub-item:last-child {
        border-bottom: none;
    }

    .sub-item:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .sub-item.active {
        background-color: rgba(12, 128, 65, 0.3);
        color: white;
        border-left: 3px solid #0C8041;
    }

    /* Vertical line indicator on left side */
    .sub-item::before {
        content: '';
        position: absolute;
        left: 2.5rem;
        top: 0;
        bottom: 0;
        width: 0;
        background-color: rgba(75, 85, 99, 0.4);
    }

.sub-icon {
    /* Hide the bullet point dots */
    display: none;
}

/* Collapsed sidebar - hide sub-menus */
.sidenav.collapsed .sub-menu {
    display: none;
}

/* Hover effect for collapsed sidebar to show submenu */
.sidenav.collapsed .nav-group:hover .sub-menu {
    display: block;
    position: absolute;
    left: 70px;
    top: 0;
    background-color: #1f2937;
    border: 1px solid #374151;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    max-height: none;
    z-index: 1000;
}

.sidenav.collapsed .nav-group:hover .sub-item {
    padding-left: 1.25rem;
}

    .sidenav.collapsed .nav-group:hover .sub-item::before {
        display: none;
    }

/* Adjust nav-item padding when it has sub-items */
.nav-group > .nav-item {
    justify-content: space-between;
}

    /* Active state for parent items */
    .nav-group > .nav-item.active {
        background-color: #374151;
        color: white;
    }

/* Mobile specific adjustments */
@media (max-width: 768px) {
    .sub-item {
        padding-left: 2.5rem;
    }
}

/* Dropdown Styles */
.dropdown-wrapper {
    position: relative;
}

.icon-button {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

    .icon-button:hover {
        background-color: #f3f4f6;
    }

    .icon-button .badge {
        position: absolute;
        top: 4px;
        right: 4px;
        background-color: #ef4444;
        color: white;
        font-size: 0.625rem;
        font-weight: 600;
        padding: 0.125rem 0.375rem;
        border-radius: 9999px;
        min-width: 18px;
        text-align: center;
    }

.account-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

    .account-button:hover {
        background-color: #f3f4f6;
    }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    min-width: 320px;
    max-width: 400px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden; /* Prevent any overflow */
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0; /* Prevent header from shrinking */
}

    .dropdown-header h6 {
        margin: 0;
        font-size: 0.875rem;
        font-weight: 600;
        color: #1f2937;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dropdown-header .text-muted {
        font-size: 0.75rem;
        color: #6b7280;
        white-space: nowrap;
    }

    .dropdown-header .btn-link {
        background: none;
        border: none;
        color: #0C8041;
        font-size: 0.75rem;
        cursor: pointer;
        text-decoration: none;
        white-space: nowrap;
    }

        .dropdown-header .btn-link:hover {
            text-decoration: underline;
        }

.dropdown-body {
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    max-height: 300px;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    text-align: left;
    overflow: hidden; /* Prevent content overflow */
}

    .dropdown-item:hover {
        background-color: #f9fafb;
    }

    .dropdown-item:last-child {
        border-bottom: none;
    }

    .dropdown-item.unread {
        background-color: #e8f5e9;
    }

    .dropdown-item svg {
        flex-shrink: 0;
        margin-right: 0.5rem;
    }

/* Messages Dropdown */
.message-item {
    align-items: flex-start;
}

    .message-item .avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
    }

.message-content {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    overflow: hidden; /* Prevent overflow */
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    gap: 0.5rem;
}

    .message-header strong {
        font-size: 0.875rem;
        color: #1f2937;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
    }

    .message-header .time {
        font-size: 0.75rem;
        color: #6b7280;
        white-space: nowrap;
        flex-shrink: 0;
    }

.message-text {
    font-size: 0.813rem;
    color: #4b5563;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Notifications Dropdown */
.notification-item {
    align-items: flex-start;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .notification-icon.success {
        background-color: #d1fae5;
        color: #10b981;
    }

    .notification-icon.warning {
        background-color: #fef3c7;
        color: #f59e0b;
    }

    .notification-icon.info {
        background-color: #d4edda;
        color: #0C8041;
    }

.notification-content {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink */
    overflow: hidden; /* Prevent overflow */
}

.notification-text {
    font-size: 0.813rem;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    word-wrap: break-word;
}

.notification-content .time {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
}