/* Layout Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--dark-color);
    color: white;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

/* Collapsed Sidebar on Desktop */
@media (min-width: 769px) {
    .app-container.sidebar-collapsed .sidebar {
        width: 70px;
    }

    .app-container.sidebar-collapsed .sidebar-title {
        display: none;
    }

    .app-container.sidebar-collapsed .nav-text {
        display: none;
    }

    .app-container.sidebar-collapsed .nav-section {
        text-align: center;
        padding: 1rem 0.5rem 0.5rem;
    }

    .app-container.sidebar-collapsed .nav-link {
        justify-content: center;
        padding: 0.75rem;
    }

    .app-container.sidebar-collapsed .sidebar-header {
        justify-content: center;
    }

    .app-container.sidebar-collapsed .sidebar-logo {
        margin: 0;
    }

    .app-container.sidebar-collapsed .version-info {
        text-align: center;
    }

    .app-container.sidebar-collapsed .version-text {
        font-size: 0.65rem;
    }
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--primary-color);
}

.nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.nav-section {
    padding: 1rem 1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

/* Version Info at Bottom of Sidebar */
.version-info {
    padding: 12px 16px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    flex-shrink: 0;
}

.version-text {
    cursor: help;
    transition: color 0.2s;
    white-space: nowrap;
}

.version-text:hover {
    color: rgba(255, 255, 255, 0.8);
}

.version-loading {
    opacity: 0.3;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: margin-left 0.3s ease;
}

/* Top Navigation Bar */
.topbar {
    height: var(--topbar-height);
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--dark-color);
    border-radius: 4px;
    transition: background-color 0.2s;
}

.menu-toggle:hover {
    background-color: var(--light-color);
}

.topbar-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--dark-color);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
}

.topbar-search input {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    width: 250px;
    transition: width 0.3s;
}

.topbar-search input:focus {
    width: 350px;
    outline: none;
    border-color: var(--primary-color);
}

.topbar-search-icon {
    position: absolute;
    right: 1rem;
    color: #999;
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: none;
    border: 1px solid #ddd;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-button:hover {
    background-color: var(--light-color);
    border-color: var(--primary-color);
}

.profile-dropdown-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.profile-name {
    font-weight: 500;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1001;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.profile-menu-item:last-child {
    border-bottom: none;
}

.profile-menu-item:hover {
    background-color: var(--light-color);
}

.profile-menu-item.danger {
    color: var(--danger-color);
}

.profile-menu-item .icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
    }

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

    .topbar-search input {
        width: 150px;
    }

    .topbar-search input:focus {
        width: 200px;
    }

    .profile-name {
        display: none;
    }

    .content-area {
        padding: 1rem;
    }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .sidebar-overlay.show {
        display: block;
    }
}
